diff --git a/src/search.cpp b/src/search.cpp index e6c3cd70..09e3c4fa 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -360,9 +360,9 @@ void Thread::search() { multiPV = std::min(multiPV, rootMoves.size()); // Iterative deepening loop until requested to stop or the target depth is reached - while ( (rootDepth = rootDepth + ONE_PLY) < DEPTH_MAX + while ( (rootDepth += ONE_PLY) < DEPTH_MAX && !Signals.stop - && (!Limits.depth || Threads.main()->rootDepth / ONE_PLY <= Limits.depth)) + && !(Limits.depth && mainThread && rootDepth / ONE_PLY > Limits.depth)) { // Distribute search depths across the threads if (idx) diff --git a/src/thread.h b/src/thread.h index c254047c..dc0c51c2 100644 --- a/src/thread.h +++ b/src/thread.h @@ -65,7 +65,7 @@ public: Position rootPos; Search::RootMoves rootMoves; - std::atomic rootDepth; + Depth rootDepth; Depth completedDepth; CounterMoveStat counterMoves; ButterflyHistory history;