X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=eb64f7ee372151ec5966d08477f9b9a040b3ef78;hp=88b4592143950c8ca2077b080d1bf1248c044396;hb=00d9e9fd283b31e63389af091b158dbc3fedfc0e;hpb=ecc5ff6693f116f4a8ae5f5080252f29b279c0a1 diff --git a/src/thread.cpp b/src/thread.cpp index 88b45921..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,10 +86,12 @@ 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; + history.clear(); + counterMoves.clear(); idx = Threads.size(); // Starts from 0 }