mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-22 07:41:20 -04:00
generally prevent threads to start twice, and fixed bug causing DirWatcher to be run twice
This commit is contained in:
parent
eb95c6895a
commit
461975f115
2 changed files with 8 additions and 3 deletions
|
@ -54,10 +54,10 @@ void LocalDirectoryUpdater::setEnabled(bool b)
|
||||||
if(mIsEnabled == b)
|
if(mIsEnabled == b)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if(b)
|
if(!b)
|
||||||
start("fs dir updater") ;
|
|
||||||
else
|
|
||||||
shutdown();
|
shutdown();
|
||||||
|
else if(!isRunning())
|
||||||
|
start("fs dir updater") ;
|
||||||
|
|
||||||
mIsEnabled = b ;
|
mIsEnabled = b ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,11 @@ void RsTickingThread::fullstop()
|
||||||
|
|
||||||
void RsThread::start(const std::string &threadName)
|
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;
|
pthread_t tid;
|
||||||
void *data = (void *)this ;
|
void *data = (void *)this ;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue