Stack stack[MAX_PLY+4], *ss = stack+2; // To allow referencing (ss-2) and (ss+2)
Position pos(*sp->pos, this);
Stack stack[MAX_PLY+4], *ss = stack+2; // To allow referencing (ss-2) and (ss+2)
Position pos(*sp->pos, this);
// After releasing the lock we can't access any SplitPoint related data
// in a safe way because it could have been released under our feet by
// the sp master.
// After releasing the lock we can't access any SplitPoint related data
// in a safe way because it could have been released under our feet by
// the sp master.
// If we are master and all slaves have finished then exit idle_loop
if (this_sp && this_sp->slavesMask.none())
// If we are master and all slaves have finished then exit idle_loop
if (this_sp && this_sp->slavesMask.none())
int64_t nodes = RootPos.nodes_searched();
// Loop across all split points and sum accumulated SplitPoint nodes plus
// all the currently active positions nodes.
int64_t nodes = RootPos.nodes_searched();
// Loop across all split points and sum accumulated SplitPoint nodes plus
// all the currently active positions nodes.
for (Thread* th : Threads)
for (size_t i = 0; i < th->splitPointsSize; ++i)
{
SplitPoint& sp = th->splitPoints[i];
for (Thread* th : Threads)
for (size_t i = 0; i < th->splitPointsSize; ++i)
{
SplitPoint& sp = th->splitPoints[i];
if (sp.slavesMask.test(idx) && Threads[idx]->activePosition)
nodes += Threads[idx]->activePosition->nodes_searched();
if (sp.slavesMask.test(idx) && Threads[idx]->activePosition)
nodes += Threads[idx]->activePosition->nodes_searched();