mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Fix a bug in timer loop
Silly logic bug introduced in dda7de17e7
Timer thread, when msec = 0, instead of going
to sleep, calls check_time() in an endless loop.
Spotted and reported by snino64 due to abnormally
high CPU usage.
No functional change.
This commit is contained in:
@@ -76,9 +76,10 @@ void TimerThread::idle_loop() {
|
|||||||
while (!do_exit)
|
while (!do_exit)
|
||||||
{
|
{
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
while (!msec && !do_exit)
|
do sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
|
||||||
sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
|
while (!msec && !do_exit); // Don't allow wakeups when msec = 0
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
check_time();
|
check_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user