- if (!useSleepingThreads)
- threads[i]->wake_up();
- }
-}
-
-
-// sleep() is called after the search finishes to ask all the threads but the
-// main one to go waiting on a sleep condition.
-
-void ThreadPool::sleep() const {
-
- for (size_t i = 1; i < size(); i++) // Main thread will go to sleep by itself
- threads[i]->do_sleep = true; // to avoid a race with start_searching()
-}
-
-
-// available_slave_exists() tries to find an idle thread which is available as
-// a slave for the thread 'master'.
-
-bool ThreadPool::available_slave_exists(Thread* master) const {
-
- for (size_t i = 0; i < size(); i++)
- if (threads[i]->is_available_to(master))
- return true;
-
- return false;