]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Pass Position as const ref in update_stats()
[stockfish] / src / thread.cpp
index 432d573d42ce2b2746a1f11cac6610979d8097ba..06244dc9bb957c41f5d47d13ed64aa59a40c6bf8 100644 (file)
@@ -194,7 +194,8 @@ void ThreadPool::init() {
 }
 
 
-// exit() cleanly terminates the threads before the program exits
+// exit() cleanly terminates the threads before the program exits. Cannot be done in
+// d'tor because we have to terminate the threads before to free ThreadPool object.
 
 void ThreadPool::exit() {
 
@@ -292,6 +293,7 @@ void Thread::split(Position& pos, const Stack* ss, Value alpha, Value beta, Valu
   Threads.mutex.lock();
   sp.mutex.lock();
 
+  sp.allSlavesSearching = true; // Must be set under lock protection
   ++splitPointsSize;
   activeSplitPoint = &sp;
   activePosition = NULL;