@@ -77,14 +77,15 @@ using namespace Eigen;
77
77
78
78
Averaging::Averaging ()
79
79
: m_pCircularBuffer(CircularBuffer<FIFFLIB::FiffEvokedSet>::SPtr::create(40 ))
80
+ , m_bProcessOutput(false )
80
81
{
81
82
}
82
83
83
84
// =============================================================================================================
84
85
85
86
Averaging::~Averaging ()
86
87
{
87
- if (this -> isRunning ())
88
+ if (m_OutputProcessingThread. joinable ())
88
89
stop ();
89
90
}
90
91
@@ -106,17 +107,18 @@ void Averaging::unload()
106
107
107
108
bool Averaging::start ()
108
109
{
109
- QThread::start ();
110
+ m_bProcessOutput = true ;
111
+ m_OutputProcessingThread = std::thread (&Averaging::run, this );
110
112
111
113
return true ;
112
114
}
113
115
114
116
// =============================================================================================================
115
117
116
118
bool Averaging::stop ()
117
- {
118
- requestInterruption () ;
119
- wait ( 500 );
119
+ {
120
+ m_bProcessOutput = false ;
121
+ m_OutputProcessingThread. join ( );
120
122
121
123
m_bPluginControlWidgetsInit = false ;
122
124
@@ -406,7 +408,7 @@ void Averaging::onChangeBaselineActive(bool state)
406
408
void Averaging::onNewEvokedSet (const FIFFLIB::FiffEvokedSet& evokedSet,
407
409
const QStringList& lResponsibleTriggerTypes)
408
410
{
409
- if (!this -> isRunning () ) {
411
+ if (!m_bProcessOutput ) {
410
412
return ;
411
413
}
412
414
@@ -439,7 +441,7 @@ void Averaging::run()
439
441
FIFFLIB::FiffEvokedSet evokedSet;
440
442
QStringList lResponsibleTriggerTypes;
441
443
442
- while (! isInterruptionRequested () ){
444
+ while (m_bProcessOutput ){
443
445
if (m_pCircularBuffer->pop (evokedSet)) {
444
446
m_qMutex.lock ();
445
447
lResponsibleTriggerTypes = m_lResponsibleTriggerTypes;
0 commit comments