X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=18870021ba3665bd026364a24594ca4bf57c26d8;hp=b8571dcd20283c9b9b7ef502559e7ca91ff05db5;hb=950c8436edc50857b83eb3e0cbaca06407764655;hpb=4eb2d8ce095b284a1e55762548d9821a83a19b3b diff --git a/src/thread.cpp b/src/thread.cpp index b8571dcd..18870021 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -89,7 +89,8 @@ void ThreadBase::wait_for(volatile const bool& condition) { Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC searching = false; - maxPly = splitPointsSize = 0; + maxPly = 0; + splitPointsSize = 0; activeSplitPoint = NULL; activePosition = NULL; idx = Threads.size(); // Starts from 0 @@ -123,7 +124,7 @@ bool Thread::available_to(const Thread* master) const { // Make a local copy to be sure it doesn't become zero under our feet while // testing next condition and so leading to an out of bounds access. - const int size = splitPointsSize; + const size_t size = splitPointsSize; // No split points means that the thread is available as a slave for any // other thread otherwise apply the "helpful master" concept if possible. @@ -182,7 +183,8 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes Thread* slave; - while ((slave = Threads.available_slave(this)) != NULL) + while ( sp.slavesMask.count() < MAX_SLAVES_PER_SPLITPOINT + && (slave = Threads.available_slave(this)) != NULL) { sp.slavesMask.set(slave->idx); slave->activeSplitPoint = &sp;