Skip to content

Commit

Permalink
Check waitFor timeout before condition wait
Browse files Browse the repository at this point in the history
  • Loading branch information
uroni committed Feb 24, 2016
1 parent 16fc18d commit 5f06358
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ThreadPool.cpp
Expand Up @@ -242,16 +242,16 @@ bool CThreadPool::waitFor(std::vector<THREADPOOL_TICKET> tickets, int timems)
break;
}

cond->wait(&lock, timems);

if(timems>=0)
if (timems >= 0)
{
int64 ctime = Server->getTimeMS();
if(ctime-starttime>timems)
if (ctime - starttime>=timems)
{
break;
}
}

cond->wait(&lock, timems);
}

for( size_t i=0;i<tickets.size();++i)
Expand Down

0 comments on commit 5f06358

Please sign in to comment.