[concurrency-interest] A little lock free algorithm [the code]

Dawid Kurzyniec dawidk at mathcs.emory.edu
Fri Mar 31 12:06:06 EST 2006

I think that unless you put the test "now < expiration" inside the 
"lock", there is a potential race condition:

1. Thread A determines that expiration passed, succeeds at compareAndSet.
2. Thread B determines that expiration passed
3. Thread A updates backoff and expiration, unlocks, and returns
4. Thread B succeeds at compareAndSet, and thus also updates backoff and 


More information about the Concurrency-interest mailing list