X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=02cb45629dff48b8048890911139efe0eae5d46a;hp=b8571dcd20283c9b9b7ef502559e7ca91ff05db5;hb=d65f75c1532536f11a2dfbc0263c55e1beb88c2b;hpb=f8f5dcbb682830a66a37f68f3c192bbbfc84a33a diff --git a/src/thread.cpp b/src/thread.cpp index b8571dcd..02cb4562 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -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