mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
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 <mcostalba@gmail.com>
This commit is contained in:
parent
8eae6a95fb
commit
40a7ffd53f
1 changed files with 11 additions and 2 deletions
|
@ -3006,11 +3006,20 @@ namespace {
|
||||||
|
|
||||||
AllThreadsShouldSleep = true;
|
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++)
|
for (int i = 1; i < ActiveThreads; i++)
|
||||||
|
{
|
||||||
while (!threads[i].sleeping);
|
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
|
// print_current_line() prints _once_ the current line of search for a
|
||||||
// given thread and then setup the print request for the next thread.
|
// given thread and then setup the print request for the next thread.
|
||||||
|
|
Loading…
Add table
Reference in a new issue