Fix endless reaparenting loop
[stockfish] / src / thread.cpp
index a644cae9b64ede6d5a1e682cd62f5aff9b4e01af..631834da4b9f60c159facb502b5f7e2c0ac3fe04 100644 (file)
@@ -319,7 +319,7 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
   sp->master = master;
   sp->cutoff = false;
   sp->slavesMask = 1ULL << master->idx;
-  sp->allSlavesMask = 1ULL << master->idx;
+  sp->allSlavesRunning = true;
   sp->depth = depth;
   sp->bestMove = *bestMove;
   sp->threatMove = threatMove;
@@ -348,7 +348,6 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
       if (threads[i]->is_available_to(master))
       {
           sp->slavesMask |= 1ULL << i;
-          sp->allSlavesMask |= 1ULL << i;
           threads[i]->curSplitPoint = sp;
           threads[i]->is_searching = true; // Slave leaves idle_loop()
 
@@ -356,10 +355,7 @@ Value ThreadsManager::split(Position& pos, Stack* ss, Value alpha, Value beta,
               threads[i]->wake_up();
 
           if (++slavesCnt + 1 >= maxThreadsPerSplitPoint) // Master is always included
-          {
-              sp->allSlavesMask = 0; // Disable reparenting to this split point
               break;
-          }
       }
 
   master->splitPointsCnt++;