]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Remove a couple of useless thread_should_stop() calls
[stockfish] / src / search.cpp
index 38e2ac14084a26442fdafa19581f5843ec1dc897..611b258329b680b5c7a07bacf466e3c6be7a55bf 100644 (file)
@@ -1851,12 +1851,6 @@ namespace {
 
       assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
 
-      if (TM.thread_should_stop(threadID))
-      {
-          lock_grab(&(sp->lock));
-          break;
-      }
-
       // New best move?
       if (value > sp->bestValue) // Less then 2% of cases
       {
@@ -1978,12 +1972,6 @@ namespace {
 
       assert(value > -VALUE_INFINITE && value < VALUE_INFINITE);
 
-      if (TM.thread_should_stop(threadID))
-      {
-          lock_grab(&(sp->lock));
-          break;
-      }
-
       // New best move?
       if (value > sp->bestValue) // Less then 2% of cases
       {
@@ -2650,6 +2638,8 @@ namespace {
         // If this thread has been assigned work, launch a search
         if (threads[threadID].state == THREAD_WORKISWAITING)
         {
+            assert(!AllThreadsShouldExit);
+
             threads[threadID].state = THREAD_SEARCHING;
 
             if (threads[threadID].splitPoint->pvNode)
@@ -2659,13 +2649,7 @@ namespace {
 
             assert(threads[threadID].state == THREAD_SEARCHING);
 
-            // If this is a slave thread reset to available, instead
-            // if it is a master thread and all slaves have finished
-            // then leave as is to avoid booking by another master,
-            // we will leave idle loop shortly anyhow.
-            if (   !AllThreadsShouldExit
-                && (!waitSp || waitSp->cpus > 0))
-                threads[threadID].state = THREAD_AVAILABLE;
+            threads[threadID].state = THREAD_AVAILABLE;
         }
 
         // If this thread is the master of a split point and all threads have