}
-/// Thread::idle_loop() is where the thread is parked when it has no work to do.
-/// The parameter 'master_sp', if non-NULL, is a pointer to an active SplitPoint
-/// object for which the thread is the master.
+/// Thread::idle_loop() is where the thread is parked when it has no work to do
-void Thread::idle_loop(SplitPoint* sp_master) {
+void Thread::idle_loop() {
+
+ // Pointer 'sp_master', if non-NULL, points to the active SplitPoint
+ // object for which the thread is the master.
+ const SplitPoint* sp_master = splitPointsCnt ? curSplitPoint : NULL;
+
+ assert(!sp_master || (sp_master->master == this && is_searching));
// 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.
// case we are the last slave of the split point.
if ( Threads.use_sleeping_threads()
&& this != sp->master
- && !sp->master->is_searching)
+ && !sp->slavesMask)
+ {
+ assert(!sp->master->is_searching);
sp->master->wake_up();
+ }
// After releasing the lock we cannot access anymore any SplitPoint
// related data in a safe way becuase it could have been released under