diff --git a/polyglot.ini b/polyglot.ini index 4e825f3c..cd7a3188 100644 --- a/polyglot.ini +++ b/polyglot.ini @@ -31,7 +31,6 @@ Aggressiveness = 100 Cowardice = 100 Min Split Depth = 0 Threads = 1 -Idle Threads Sleep = true Hash = 128 Ponder = true OwnBook = false diff --git a/src/search.cpp b/src/search.cpp index 22a954ae..dfe690b4 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -226,14 +226,12 @@ void Search::think() { for (size_t i = 0; i < Threads.size(); ++i) Threads[i]->maxPly = 0; - Threads.sleepWhileIdle = Options["Idle Threads Sleep"]; Threads.timer->run = true; Threads.timer->notify_one(); // Wake up the recurring timer id_loop(RootPos); // Let's start searching ! Threads.timer->run = false; // Stop the timer - Threads.sleepWhileIdle = true; // Send idle threads to sleep if (Options["Write Search Log"]) { @@ -1462,7 +1460,7 @@ void Thread::idle_loop() { { // If we are not searching, wait for a condition to be signaled instead of // wasting CPU time polling for work. - while ((!searching && Threads.sleepWhileIdle) || exit) + while (!searching || exit) { if (exit) { @@ -1537,8 +1535,7 @@ void Thread::idle_loop() { // Wake up the master thread so to allow it to return from the idle // loop in case we are the last slave of the split point. - if ( Threads.sleepWhileIdle - && this != sp->masterThread + if ( this != sp->masterThread && sp->slavesMask.none()) { assert(!sp->masterThread->searching); diff --git a/src/thread.cpp b/src/thread.cpp index 06244dc9..344cfb79 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -181,13 +181,12 @@ void MainThread::idle_loop() { // init() is called at startup to create and launch requested threads, that will -// go immediately to sleep due to 'sleepWhileIdle' set to true. We cannot use -// a c'tor because Threads is a static object and we need a fully initialized -// engine at this point due to allocation of Endgames in Thread c'tor. +// go immediately to sleep. We cannot use a c'tor because Threads is a static +// object and we need a fully initialized engine at this point due to allocation +// of Endgames in Thread c'tor. void ThreadPool::init() { - sleepWhileIdle = true; timer = new_thread(); push_back(new_thread()); read_uci_options(); diff --git a/src/thread.h b/src/thread.h index 66df55b5..35654312 100644 --- a/src/thread.h +++ b/src/thread.h @@ -166,7 +166,6 @@ struct ThreadPool : public std::vector { void wait_for_think_finished(); void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&); - bool sleepWhileIdle; Depth minimumSplitDepth; Mutex mutex; ConditionVariable sleepCondition; diff --git a/src/ucioption.cpp b/src/ucioption.cpp index e117e44c..d5db2c97 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -71,7 +71,6 @@ void init(OptionsMap& o) { o["Cowardice"] << Option(100, 0, 200, on_eval); o["Min Split Depth"] << Option(0, 0, 12, on_threads); o["Threads"] << Option(1, 1, MAX_THREADS, on_threads); - o["Idle Threads Sleep"] << Option(true); o["Hash"] << Option(32, 1, 16384, on_hash_size); o["Clear Hash"] << Option(on_clear_hash); o["Ponder"] << Option(true);