From 40a7ffd53fdcd63a7eeb1382e54a5bdcd455edb7 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 14 Feb 2010 15:58:46 +0100 Subject: [PATCH] Reset thread flags to a known state before to exit think() Among them 'stop' and 'printCurrentLineRequest' could have random value, so reset to a known state before to leave the search. No functional change. Signed-off-by: Marco Costalba --- src/search.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 8d0f758d..197a130f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -3006,11 +3006,20 @@ namespace { AllThreadsShouldSleep = true; - // Wait for the threads to be all sleeping + // Wait for the threads to be all sleeping and reset flags + // to a known state. for (int i = 1; i < ActiveThreads; i++) + { while (!threads[i].sleeping); - } + assert(threads[i].idle); + assert(threads[i].running); + assert(!threads[i].workIsWaiting); + + // These two flags can be in a random state + threads[i].stop = threads[i].printCurrentLineRequest = false; + } + } // print_current_line() prints _once_ the current line of search for a // given thread and then setup the print request for the next thread. -- 2.39.2