ruby/ruby — pull request #729 by mputters (2014-09-30 17:00:14+00:00)
Title: Fixed atomic correctness for gcc intrinsics used by ATOMIC_INC/ATOMIC_DEC

This pull request fixes the gcc atomic intrinsics used by the ATOMIC_INC and ATOMIC_DEC macros.

- For Win32 and Sun, the macros return the new value after the increment/decrement
- For gcc, the macros return the value prior to the increment/decrement

Simply using *_fetch instead of fetch_* ensures the behavior is coherent for all platforms.
From a quick search, it seems the only place where ATOMIC_INC and ATOMIC_DEC is not affected by this issue as it doesn't really care about the atomic properties of the operation, so this is mostly future-proofing the macros.