do pos.undo_move(pv[--ply]); while (ply);
}
-} // namespace
-
-
-// Little helper used by idle_loop() to check that all the slave threads of a
-// split point have finished searching.
-
-static bool all_slaves_finished(SplitPoint* sp) {
- for (int i = 0; i < Threads.size(); i++)
- if (sp->is_slave[i])
- return false;
-
- return true;
-}
+} // namespace
// Thread::idle_loop() is where the thread is parked when it has no work to do.
lock_grab(&sleepLock);
// If we are master and all slaves have finished don't go to sleep
- if (sp && all_slaves_finished(sp))
+ if (sp && Threads.split_point_finished(sp))
{
lock_release(&sleepLock);
break;
// If this thread is the master of a split point and all slaves have
// finished their work at this split point, return from the idle loop.
- if (sp && all_slaves_finished(sp))
+ if (sp && Threads.split_point_finished(sp))
{
// Because sp->is_slave[] is reset under lock protection,
// be sure sp->lock has been released before to return.