Skip to content

Commit

Permalink
MAINT: change potential blocking thread stop from within thread
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbmotta committed Jul 22, 2021
1 parent 15a3121 commit e867f9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,22 @@ void PluginSceneManager::stopPlugins()
// Stop AbstractSensor plugins first!
QList<AbstractPlugin::SPtr>::iterator it = m_pluginList.begin();
for( ; it != m_pluginList.end(); ++it)
if((*it)->getType() == AbstractPlugin::_ISensor)
if((*it)->getType() == AbstractPlugin::_ISensor){
(*it)->requestInterruption();
(*it)->wait();
if(!(*it)->stop())
qWarning() << "Could not stop AbstractPlugin: " << (*it)->getName();
}

// Stop all other plugins!
it = m_pluginList.begin();
for( ; it != m_pluginList.end(); ++it)
if((*it)->getType() != AbstractPlugin::_ISensor)
if((*it)->getType() != AbstractPlugin::_ISensor){
(*it)->requestInterruption();
(*it)->wait();
if(!(*it)->stop())
qWarning() << "Could not stop AbstractPlugin: " << (*it)->getName();
}
}

//=============================================================================================================
Expand Down
3 changes: 0 additions & 3 deletions applications/mne_scan/plugins/ftbuffer/ftbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ bool FtBuffer::stop()
msleep(10);
}

requestInterruption();
wait();

//Reset ftproducer and sample received list
m_pFtBuffProducer.clear();
m_pFtBuffProducer = QSharedPointer<FtBuffProducer>::create(this);
Expand Down

0 comments on commit e867f9a

Please sign in to comment.