]> git.sesse.net Git - stockfish/commit
Simplify locking in sp_search and sp_search_pv
authorMarco Costalba <mcostalba@gmail.com>
Wed, 27 Jan 2010 16:29:34 +0000 (17:29 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 27 Jan 2010 16:58:04 +0000 (17:58 +0100)
commitbb968fd42a6e3c14755332f5a4c4829faaf4f9de
treebe52ce3def0b146309d52be6a546e636ebbae4eb
parent307909bed8e86cc90e03ae8b66884d7b73beb814
Simplify locking in sp_search and sp_search_pv

Avoid to take the lock two times in a tight sequence, the first
in get_next_move() and the second to update sp->moves.

Do all with one lock and so retire the now useless locked version
of get_next_move().

Also fix some theorical race due to comparison sp->bestValue < sp->beta
is done out of lock protection. Finally fix another (harmless but time
waster) race that coudl occur because thread_should_stop() is also
called outside of lock protection.

No functional change.

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