-// Little helper used by idle_loop() to check that all the slaves of a
-// master thread have finished searching.
+// Little helper used by idle_loop() to check that all the slave threads of a
+// split point have finished searching.
// particular we need to avoid a deadlock in case a master thread has,
// in the meanwhile, allocated us and sent the wake_up() call before we
// had the chance to grab the lock.
// particular we need to avoid a deadlock in case a master thread has,
// in the meanwhile, allocated us and sent the wake_up() call before we
// had the chance to grab the lock.
cond_wait(&sleepCond, &sleepLock);
lock_release(&sleepLock);
}
// If this thread has been assigned work, launch a search
cond_wait(&sleepCond, &sleepLock);
lock_release(&sleepLock);
}
// If this thread has been assigned work, launch a search
// Copy split point position and search stack and call search()
SearchStack ss[PLY_MAX_PLUS_2];
SplitPoint* tsp = splitPoint;
// Copy split point position and search stack and call search()
SearchStack ss[PLY_MAX_PLUS_2];
SplitPoint* tsp = splitPoint;
// Wake up master thread so to allow it to return from the idle loop in
// case we are the last slave of the split point.
if ( Threads.use_sleeping_threads()
&& threadID != tsp->master
// Wake up master thread so to allow it to return from the idle loop in
// case we are the last slave of the split point.
if ( Threads.use_sleeping_threads()
&& threadID != tsp->master