X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=30299ac435e68c1305f8708914cc79cbd86c9dd7;hp=21db685285972f12c571078dec42751d76201228;hb=79e50a2fbfdf2e866255e002b7d7cdc55d96bb9e;hpb=2c317d7b28161e74f0cdc0a00922b48cb996321f diff --git a/src/search.cpp b/src/search.cpp index 21db6852..30299ac4 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -76,7 +76,6 @@ namespace { bool available_thread_exists(int master) const; bool thread_is_available(int slave, int master) const; bool cutoff_at_splitpoint(int threadID) const; - void wake_sleeping_thread(int threadID); void idle_loop(int threadID, SplitPoint* sp); template @@ -509,7 +508,7 @@ bool think(Position& pos, bool infinite, bool ponder, int time[], int increment[ // Wake up needed threads and reset maxPly counter for (int i = 0; i < ThreadsMgr.active_threads(); i++) { - ThreadsMgr.wake_sleeping_thread(i); + ThreadsMgr[i].wake_up(); ThreadsMgr[i].maxPly = 0; } @@ -2107,7 +2106,7 @@ split_point_start: // At split points actual search starts from here // Wake up master thread so to allow it to return from the idle loop in // case we are the last slave of the split point. if (useSleepingThreads && threadID != tsp->master && threads[tsp->master].state == THREAD_AVAILABLE) - wake_sleeping_thread(tsp->master); + threads[tsp->master].wake_up(); } // If this thread is the master of a split point and all slaves have @@ -2201,7 +2200,7 @@ split_point_start: // At split points actual search starts from here // Wake up all the threads and waits for termination for (int i = 1; i < MAX_THREADS; i++) { - wake_sleeping_thread(i); + threads[i].wake_up(); while (threads[i].state != THREAD_TERMINATED) {} } @@ -2376,7 +2375,7 @@ split_point_start: // At split points actual search starts from here threads[i].state = THREAD_WORKISWAITING; // This makes the slave to exit from idle_loop() if (useSleepingThreads && i != master) - wake_sleeping_thread(i); + threads[i].wake_up(); } // Everything is set up. The master thread enters the idle loop, from @@ -2400,17 +2399,6 @@ split_point_start: // At split points actual search starts from here } - // wake_sleeping_thread() wakes up the thread with the given threadID - // when it is time to start a new search. - - void ThreadsManager::wake_sleeping_thread(int threadID) { - - lock_grab(&threads[threadID].sleepLock); - cond_signal(&threads[threadID].sleepCond); - lock_release(&threads[threadID].sleepLock); - } - - /// RootMove and RootMoveList method's definitions RootMove::RootMove() {