X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=902ba0fc6915769c157ef096f6b83340049794db;hp=78e4748f5ce64a51efbd2b33821f3579b8d87097;hb=00d9e9fd283b31e63389af091b158dbc3fedfc0e;hpb=3428a2875197c805c25fdd954ba3a24d00845a2a;ds=sidebyside diff --git a/src/search.cpp b/src/search.cpp index 78e4748f..902ba0fc 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -37,7 +37,7 @@ namespace Search { - volatile SignalsType Signals; + SignalsType Signals; LimitsType Limits; StateStackPtr SetupStates; } @@ -581,8 +581,8 @@ namespace { if (!RootNode) { // Step 2. Check for aborted search and immediate draw - if (Signals.stop || pos.is_draw() || ss->ply >= MAX_PLY) - return ss->ply >= MAX_PLY && !inCheck ? evaluate(pos) + if (Signals.stop.load(std::memory_order_relaxed) || pos.is_draw() || ss->ply >= MAX_PLY) + return ss->ply >= MAX_PLY && !inCheck ? evaluate(pos) : DrawValue[pos.side_to_move()]; // Step 3. Mate distance pruning. Even if we mate at the next move our score @@ -841,7 +841,7 @@ moves_loop: // When in check search starts from here if (RootNode && thisThread == Threads.main()) { - Signals.firstRootMove = (moveCount == 1); + Signals.firstRootMove = moveCount == 1; if (Time.elapsed() > 3000) sync_cout << "info depth " << depth / ONE_PLY @@ -1008,7 +1008,7 @@ moves_loop: // When in check search starts from here // Finished searching the move. If a stop occurred, the return value of // the search cannot be trusted, and we return immediately without // updating best move, PV and TT. - if (Signals.stop) + if (Signals.stop.load(std::memory_order_relaxed)) return VALUE_ZERO; if (RootNode) @@ -1577,7 +1577,7 @@ void check_time() { { bool stillAtFirstMove = Signals.firstRootMove && !Signals.failedLowAtRoot - && elapsed > Time.available() * 75 / 100; + && elapsed > Time.available() * 3 / 4; if ( stillAtFirstMove || elapsed > Time.maximum() - 2 * TimerThread::Resolution)