On Mon, May 30, 2016 at 02:19:26PM -0700, Charles Cui wrote: > good to know atomic_inc_uint_nv is implemented using cas.
No, atomic_inc is *not* necessarily implemented using CAS. There are a couple of different ways to do it ranging from implicit serialisation on UP-only systems over CAS/LL-SC loops to native locked inc instructions. For the application program, it doesn't generally matter which it is. Joerg