boundary/overlock — Issue #2: Possible race condition in SpinLock
Author: mgodave
Created: 2011-11-28 21:59:23+00:00
State: open

I believe there is a possible race condition in the SpinLock class. The following serialization shows the issue:

count: 0, writer: true

R1 writer.get => true
W1 writer.set(false)
R1 writer.get => false
W2 writer.set(true)
W2 count.get => 0
W2
R1 count.incrementAndGet => 1
R1

It looks like it is possible for a reader and a writer to be in the critical section at the same time.