]> git.sesse.net Git - stockfish/commit
Fix race in ThreadsManager::sleep()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 25 Mar 2012 15:31:50 +0000 (16:31 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 25 Mar 2012 15:37:48 +0000 (16:37 +0100)
commit58c2fe391d869e417e568cd47eea77d46a408f9b
treee8b97dcc49ebb15b5536a7398b02d98f52b279c7
parentc483ffc773c012b49f4ea2f5bd1d788c1f0dc4ac
Fix race in ThreadsManager::sleep()

We cannot set do_sleep flag of main thread before
"bestmove" is sent to GUI, otherwise GUI could send
immediately the next "go" command that triggers
start_thinking() and because do_sleep is set UI
thread resets the flag to launch a new search. But
when shortly after main thread returns to main_loop()
flag is incorrectly reset and main thread goes to sleep
hanging the engine.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/thread.cpp