Remove Thread::WORKISWAITING
authorMarco Costalba <mcostalba@gmail.com>
Wed, 10 Aug 2011 11:05:33 +0000 (12:05 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 10 Aug 2011 11:05:33 +0000 (12:05 +0100)
Set the state directly to Thread::SEARCHING

No functional change.

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

index 9923ef1dbc1fdf5ce2d6493dc05662d599900e29..65b128f5f0dce6a18133113e2f7ecf3954c3101d 100644 (file)
@@ -2187,12 +2187,10 @@ void Thread::idle_loop(SplitPoint* sp) {
       }
 
       // If this thread has been assigned work, launch a search
-      if (state == Thread::WORKISWAITING)
+      if (state == Thread::SEARCHING)
       {
           assert(!do_terminate);
 
-          state = Thread::SEARCHING;
-
           // Copy split point position and search stack and call search()
           SearchStack ss[PLY_MAX_PLUS_2];
           SplitPoint* tsp = splitPoint;
index ac0be89fdcaee7766bbe8a3ede5765f90d7c691f..f620c71c69d2640de29e098ba904f68ddcadd023 100644 (file)
@@ -303,7 +303,7 @@ Value ThreadsManager::split(Position& pos, SearchStack* ss, Value alpha, Value b
           threads[i].splitPoint = sp;
 
           // This makes the slave to exit from idle_loop()
-          threads[i].state = Thread::WORKISWAITING;
+          threads[i].state = Thread::SEARCHING;
 
           if (useSleepingThreads)
               threads[i].wake_up();
@@ -317,7 +317,6 @@ Value ThreadsManager::split(Position& pos, SearchStack* ss, Value alpha, Value b
 
   masterThread.splitPoint = sp;
   masterThread.activeSplitPoints++;
-  masterThread.state = Thread::WORKISWAITING;
 
   // Everything is set up. The master thread enters the idle loop, from
   // which it will instantly launch a search, because its state is
index 574c596481a81388f5ec61632166dc8d6b15a0bc..8d3fd615bcb3fa089c0d072075cb3299b37a01a0 100644 (file)
@@ -68,7 +68,6 @@ struct Thread {
   enum ThreadState
   {
     AVAILABLE,     // Thread is waiting for work
-    WORKISWAITING, // Master has ordered us to start searching
     SEARCHING      // Thread is performing work
   };