mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 09:06:45 +08:00
Set timer to a fixed interval
And remove a complex (and broken) formula. Indeed previous code was broken in case of TC with big time increments where available_time() was too similar to total time yielding to many time losses, so for instance: go wtime 2600 winc 2600 info nodes 4432770 time 2601 <-- time forfeit! maximum search time = 2530 ms available_time = 2300 ms For a reference and further details see: https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/dCPAvQDcm2E Speed tested with bench disabling timer alltogheter vs timer set at max resolution, showed we have no speed regressions both in single core and when using all physical cores. No functional change.
This commit is contained in:
@@ -101,11 +101,11 @@ void TimerThread::idle_loop() {
|
||||
mutex.lock();
|
||||
|
||||
if (!exit)
|
||||
sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
|
||||
sleepCondition.wait_for(mutex, run ? Resolution : INT_MAX);
|
||||
|
||||
mutex.unlock();
|
||||
|
||||
if (msec)
|
||||
if (run)
|
||||
check_time();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user