diff --git a/src/search.cpp b/src/search.cpp index 5af48207..4dd459ae 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1572,27 +1572,6 @@ bool RootMove::extract_ponder_from_tt(Position& pos) } -/// Thread::idle_loop() is where the thread is parked when it has no work to do - -void Thread::idle_loop() { - - while (!exit) - { - // If this thread has been assigned work, launch a search - if (searching) - this->search(); - - // If search is finished then sleep - if (!Threads.main()->thinking) - { - std::unique_lock lk(mutex); - while (!exit && !Threads.main()->thinking) - sleepCondition.wait(lk); - } - } -} - - /// check_time() is called by the timer thread when the timer triggers. It is /// used to print debug info and, more importantly, to detect when we are out of /// available time and thus stop the search. diff --git a/src/thread.cpp b/src/thread.cpp index 14d3bab1..ac4c170e 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -106,6 +106,27 @@ void TimerThread::idle_loop() { } +// Thread::idle_loop() is where the thread is parked when it has no work to do + +void Thread::idle_loop() { + + while (!exit) + { + // If this thread has been assigned work, launch a search + if (searching) + this->search(); + + // If search is finished then sleep + if (!Threads.main()->thinking) + { + std::unique_lock lk(mutex); + while (!exit && !Threads.main()->thinking) + sleepCondition.wait(lk); + } + } +} + + // MainThread::idle_loop() is where the main thread is parked waiting to be started // when there is a new search. The main thread will launch all the slave threads.