Avoid wake up master thread when useless
authorMarco Costalba <mcostalba@gmail.com>
Sun, 19 Aug 2012 12:06:26 +0000 (13:06 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 19 Aug 2012 22:01:47 +0000 (23:01 +0100)
Check we are the last slave of the split point
before to wake up the master. This should avoid
spurious wakes up.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 043ada63d6fdd22306d5add2709b325fa768902d..a29fd0f64772e9ae7048a52973697f5da99f7fc5 100644 (file)
@@ -1728,8 +1728,11 @@ void Thread::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