X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=786258a2ed564961fdb75f67024944aaf8c25d49;hp=02cb45629dff48b8048890911139efe0eae5d46a;hb=9369f4963d9376820cb5ca4bad66b86e67b0a010;hpb=d65f75c1532536f11a2dfbc0263c55e1beb88c2b diff --git a/src/thread.cpp b/src/thread.cpp index 02cb4562..786258a2 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. @@ -152,11 +153,9 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes // Pick and init the next available split point SplitPoint& sp = splitPoints[splitPointsSize]; - sp.masterThread = this; + sp.master = this; sp.parentSplitPoint = activeSplitPoint; - sp.spLevel = activeSplitPoint ? activeSplitPoint->spLevel + 1 : 0; sp.slavesMask = 0, sp.slavesMask.set(idx); - sp.slavesCount = 1; sp.depth = depth; sp.bestValue = *bestValue; sp.bestMove = *bestMove; @@ -184,11 +183,10 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes Thread* slave; - while ( sp.slavesCount < MAX_SLAVES_PER_SPLITPOINT + while ( sp.slavesMask.count() < MAX_SLAVES_PER_SPLITPOINT && (slave = Threads.available_slave(this)) != NULL) { sp.slavesMask.set(slave->idx); - sp.slavesCount++; slave->activeSplitPoint = &sp; slave->searching = true; // Slave leaves idle_loop() slave->notify_one(); // Could be sleeping