]> git.sesse.net Git - stockfish/commitdiff
Improve spinlock implementation
authorMarco Costalba <mcostalba@gmail.com>
Mon, 23 Feb 2015 18:22:37 +0000 (19:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 23 Feb 2015 18:48:46 +0000 (19:48 +0100)
Calling lock.test_and_set() in a tight loop creates expensive
memory synchronizations among processors and penalize other
running threads. So syncronize only only once at the beginning
with fetch_sub() and then loop on a simple load() that puts much
less pressure on the system.

Reported about 2-3% speed up on various systems.

Patch by Ronald de Man.

No functional change.


No differences found