Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC
searching = false;
- maxPly = splitPointsSize = 0;
+ maxPly = 0;
+ splitPointsSize = 0;
activeSplitPoint = nullptr;
activePosition = nullptr;
idx = Threads.size(); // Starts from 0
// 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.
// Pick and init the next available split point
SplitPoint& sp = splitPoints[splitPointsSize];
- sp.masterThread = this;
+ sp.master = this;
sp.parentSplitPoint = activeSplitPoint;
sp.slavesMask = 0, sp.slavesMask.set(idx);
sp.depth = depth;
Thread* slave;
- while ((slave = Threads.available_slave(this)) != nullptr)
+ while ( sp.slavesMask.count() < MAX_SLAVES_PER_SPLITPOINT
+ && (slave = Threads.available_slave(this)) != nullptr)
{
sp.slavesMask.set(slave->idx);
slave->activeSplitPoint = &sp;