Re: [Mesa-dev] [PATCH v2 2/8] util/u_atomic: add p_atomic_xchg

2017-11-03 Thread Marek Olšák
Reviewed-by: Marek Olšák Marek On Fri, Nov 3, 2017 at 9:09 PM, Nicolai Hähnle wrote: > From: Nicolai Hähnle > > The closest to it in the old-style gcc builtins is __sync_lock_test_and_set, > however, that is only guaranteed to work with values 0 and 1 and only > provides an acquire barrier. I

[Mesa-dev] [PATCH v2 2/8] util/u_atomic: add p_atomic_xchg

2017-11-03 Thread Nicolai Hähnle
From: Nicolai Hähnle The closest to it in the old-style gcc builtins is __sync_lock_test_and_set, however, that is only guaranteed to work with values 0 and 1 and only provides an acquire barrier. I also don't know about other OSes, so we provide a simple & stupid emulation via p_atomic_cmpxchg.