X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fthread.cpp;h=02cb45629dff48b8048890911139efe0eae5d46a;hb=d65f75c1532536f11a2dfbc0263c55e1beb88c2b;hp=b79675f7c09dee12b68382691daab63db4a435b6;hpb=42b48b08e81b55e385e55b3074b7c59d81809a45;p=stockfish diff --git a/src/thread.cpp b/src/thread.cpp index b79675f7..02cb4562 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -86,7 +86,7 @@ void ThreadBase::wait_for(volatile const bool& condition) { // Thread c'tor makes some init but does not launch any execution thread that // will be started only when c'tor returns. -Thread::Thread() /* : splitPoints() */ { // Value-initialization bug in MSVC +Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC searching = false; maxPly = splitPointsSize = 0; @@ -154,7 +154,9 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes sp.masterThread = 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; @@ -182,9 +184,11 @@ void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bes Thread* slave; - while ((slave = Threads.available_slave(this)) != NULL) + while ( sp.slavesCount < 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