]> git.sesse.net Git - stockfish/commit
Fix a (theoretical) race leading to a crash
authorMarco Costalba <mcostalba@gmail.com>
Fri, 6 Apr 2012 14:22:02 +0000 (15:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 6 Apr 2012 14:30:41 +0000 (15:30 +0100)
commitbed4075580e87dd85c8c80dbd7c828268af2e324
tree6242c0887bcbca6aad54a52b7a820987ed18453c
parent5a2d525048ca5eec1d5d0effc8868cb2fdc701bb
Fix a (theoretical) race leading to a crash

After we release the SplitPoint lock the master, suppose
is main thread, can safely return and if a "quit" command
is pending, main thread exits and associated Thread object
is freed. So when we access master->is_searching a crash
occurs.

I have never found such a race that is of course very rare
becuase assumes that from lock releasing we go to sleep for
a time long enough for the main thread to end the search and
return. But you can never know, and anyhow a race is a race.

No functional change.

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