diff --git a/src/search.cpp b/src/search.cpp index d79b452d9b4..6f7a1bf0e3c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -890,6 +890,11 @@ Value Search::Worker::search( pos.undo_move(move); + // If a stop occurred, the return value of the search cannot be trusted, and we + // must return immediately without updating any histories nor the transposition table. + if (threads.stop.load(std::memory_order_relaxed)) + return VALUE_ZERO; + if (value >= probCutBeta) { thisThread->captureHistory[movedPiece][move.to_sq()][type_of(captured)]