A spinlock is a mutual exclusion primitive in which a thread repeatedly checks an atomic lock variable until it can set the variable and enter the critical section.
The waiting thread does not block; it spins in a loop.
Mechanism
Atomic acquisition
A spinlock requires an atomic operation for acquisition. Ordinary loads and stores are insufficient, because the read of the lock variable and the write to it are not indivisible.