X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=eb64f7ee372151ec5966d08477f9b9a040b3ef78;hp=dd8c398cecf2932abcfc73ef57d97e9160eb026a;hb=00d9e9fd283b31e63389af091b158dbc3fedfc0e;hpb=3428a2875197c805c25fdd954ba3a24d00845a2a diff --git a/src/thread.cpp b/src/thread.cpp index dd8c398c..eb64f7ee 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -68,16 +68,15 @@ void ThreadBase::notify_one() { // ThreadBase::wait() set the thread to sleep until 'condition' turns true -void ThreadBase::wait(volatile const bool& condition) { +void ThreadBase::wait(std::atomic& condition) { std::unique_lock lk(mutex); - sleepCondition.wait(lk, [&]{ return condition; }); + sleepCondition.wait(lk, [&]{ return bool(condition); }); } // ThreadBase::wait_while() set the thread to sleep until 'condition' turns false - -void ThreadBase::wait_while(volatile const bool& condition) { +void ThreadBase::wait_while(std::atomic& condition) { std::unique_lock lk(mutex); sleepCondition.wait(lk, [&]{ return !condition; }); @@ -87,7 +86,7 @@ void ThreadBase::wait_while(volatile const bool& condition) { // Thread c'tor makes some init but does not launch any execution thread that // will be started only when c'tor returns. -Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC +Thread::Thread() { searching = false; maxPly = 0;