ruby-concurrency/atomic — pull request #4 by alexdowad (2014-08-09 12:19:43+00:00)
Title: Volatile semantics for get set

In Java, reads/writes to `volatile` variables provide definite, clearly-defined guarantees for memory visibility and "happens-before" relationships. Ruby (sadly) doesn't specify what memory-model semantics reads and writes to variables have. Basically, it does whatever the underlying compiler and hardware do "by default".

The `atomic` gem has a great opportunity to make things right. These patches give `Atomic#get`, `#set`, and `#swap` semantics like those of a Java `volatile`. Actually, they may be stronger -- I'd like to just use a load barrier in `ir_get` and a store barrier in `ir_set`, but I don't know how to do that short of using inline assembly.

Feedback please!

Closes #3.