mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-18 16:16:23 +08:00
Retire set_timer()
Also assure in Thread::timer_loop() that when timer interval is 0 (timer is disabled) we never call check_time() No functional change.
This commit is contained in:
@@ -80,7 +80,8 @@ void Thread::timer_loop() {
|
||||
while (!do_exit)
|
||||
{
|
||||
mutex.lock();
|
||||
sleepCondition.wait_for(mutex, maxPly ? maxPly : INT_MAX);
|
||||
while (!maxPly && !do_exit)
|
||||
sleepCondition.wait_for(mutex, maxPly ? maxPly : INT_MAX);
|
||||
mutex.unlock();
|
||||
check_time();
|
||||
}
|
||||
@@ -237,16 +238,6 @@ bool ThreadPool::available_slave_exists(Thread* master) const {
|
||||
}
|
||||
|
||||
|
||||
// set_timer() is used to set the timer to trigger after msec milliseconds.
|
||||
// If msec is 0 then timer is stopped.
|
||||
|
||||
void ThreadPool::set_timer(int msec) {
|
||||
|
||||
timer->maxPly = msec;
|
||||
timer->notify_one(); // Wake up and restart the timer
|
||||
}
|
||||
|
||||
|
||||
// split() does the actual work of distributing the work at a node between
|
||||
// several available threads. If it does not succeed in splitting the node
|
||||
// (because no idle threads are available, or because we have no unused split
|
||||
|
||||
Reference in New Issue
Block a user