generally prevent threads to start twice, and fixed bug causing DirWatcher to be run twice

This commit is contained in:
cyril soler 2016-11-07 10:09:28 +01:00
parent eb95c6895a
commit 461975f115
2 changed files with 8 additions and 3 deletions

View File

@ -54,10 +54,10 @@ void LocalDirectoryUpdater::setEnabled(bool b)
if(mIsEnabled == b)
return ;
if(b)
start("fs dir updater") ;
else
if(!b)
shutdown();
else if(!isRunning())
start("fs dir updater") ;
mIsEnabled = b ;
}

View File

@ -157,6 +157,11 @@ void RsTickingThread::fullstop()
void RsThread::start(const std::string &threadName)
{
if(isRunning())
{
std::cerr << "(EE) RsThread \"" << threadName << "\" is already running. Will not start twice!" << std::endl;
return ;
}
pthread_t tid;
void *data = (void *)this ;