X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=76d0350c9c7284cf2e4ec400166174f63891c7f3;hp=1062c9203a7bbc0c31c0b134e1d1f882d95f4a76;hb=b9d4e6f7fd238edffd91ebbf4b944cddcd65a955;hpb=4f906a25897467ba8fc7c31aa634cefc1ec0dba9 diff --git a/src/search.cpp b/src/search.cpp index 1062c920..76d0350c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1589,7 +1589,7 @@ void Thread::idle_loop() { // Try to late join to another split point if none of its slaves has // already finished. SplitPoint* bestSp = NULL; - int bestThread = 0; + Thread* bestThread = NULL; int bestScore = INT_MAX; for (size_t i = 0; i < Threads.size(); ++i) @@ -1602,6 +1602,9 @@ void Thread::idle_loop() { && sp->slavesCount < MAX_SLAVES_PER_SPLITPOINT && available_to(Threads[i])) { + assert(this != Threads[i]); + assert(!(this_sp && this_sp->slavesMask.none())); + // Compute the recursive split points chain size int level = -1; for (SplitPoint* spp = Threads[i]->activeSplitPoint; spp; spp = spp->parentSplitPoint) @@ -1612,7 +1615,7 @@ void Thread::idle_loop() { if (score < bestScore) { bestSp = sp; - bestThread = i; + bestThread = Threads[i]; bestScore = score; } } @@ -1628,7 +1631,7 @@ void Thread::idle_loop() { if ( sp->allSlavesSearching && sp->slavesCount < MAX_SLAVES_PER_SPLITPOINT - && available_to(Threads[bestThread])) + && available_to(bestThread)) { sp->slavesMask.set(idx); sp->slavesCount++;