]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Rewrite how threads are spawned
[stockfish] / src / search.cpp
index 4a0302e51f9e7087d72892bdc23e84339ddef191..1e9c5010c97df7c56f2221b6b96081bdd49dc466 100644 (file)
@@ -290,12 +290,11 @@ void MainThread::search() {
       {
           th->maxPly = 0;
           th->rootDepth = DEPTH_ZERO;
-          th->searching = true;
           if (th != this)
           {
               th->rootPos = Position(rootPos, th);
               th->rootMoves = rootMoves;
-              th->notify_one(); // Wake up the thread and start searching
+              th->start_searching();
           }
       }
 
@@ -324,7 +323,7 @@ void MainThread::search() {
   // Wait until all threads have finished
   for (Thread* th : Threads)
       if (th != this)
-          th->join();
+          th->wait_for_search_finished();
 
   // Check if there are threads with a better score than main thread.
   Thread* bestThread = this;