1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Avoid a needless locking in sp_search()

Only in less then 2% of cases we have a new sp->bestValue,
so check before to lock and save a costly locking
most of the times.

Patch suggested by Joona.

No functional search.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-10-19 07:44:06 +01:00
parent f0b0a3b135
commit 51c3af9dd0

View file

@ -1759,6 +1759,8 @@ namespace {
break;
// New best move?
if (value > sp->bestValue) // Less then 2% of cases
{
lock_grab(&(sp->lock));
if (value > sp->bestValue && !thread_should_stop(threadID))
{
@ -1775,6 +1777,7 @@ namespace {
}
lock_release(&(sp->lock));
}
}
lock_grab(&(sp->lock));