X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=9bd7498979761942ba0b0e01f315e2c444385c26;hp=5f3b4d314bfb2b6edf27d65dec92b47d6dfafa96;hb=c465f4c4df1a8ad3d5c1e3759c6aa27b777b8a77;hpb=8737b26a23afb36d70cb32e3d53eeac7239685bf diff --git a/src/thread.cpp b/src/thread.cpp index 5f3b4d31..9bd74989 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -76,11 +76,14 @@ void TimerThread::idle_loop() { while (!do_exit) { mutex.lock(); - do sleepCondition.wait_for(mutex, msec ? msec : INT_MAX); - while (!msec && !do_exit); // Don't allow wakeups when msec = 0 + + if (!do_exit) + sleepCondition.wait_for(mutex, msec ? msec : INT_MAX); + mutex.unlock(); - check_time(); + if (msec) + check_time(); } }