Please sign in to comment.
Rework SpinLock to use test_and_set and test_and_clear primitives
This uses the GCC atomic built-ins which are also described here http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html for atomic test and set and test and clear. It has the right memory barrier semantics for the memory barrier we need for it. It also reworks some places where we should use a SpinLock instead of the primitive operations. This fixes hangs such as the following: https://gist.github.com/511305b6e435ef7d7d1c Here it keeps hanging in the SpinLock forever because it doesn't properly see the SpinLock being unlocked somewhere else.
- Loading branch information...
Showing with 63 additions and 21 deletions.