]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Retire redundant sp->slavesCount field
[stockfish] / src / thread.cpp
index b79675f7c09dee12b68382691daab63db4a435b6..8be7b7214bf44661265bf0899a23860415a464cd 100644 (file)
@@ -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;
@@ -182,7 +182,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;