• Nicolai Hähnle's avatar
    util/u_atomic: add p_atomic_xchg · 0a7f17cf
    Nicolai Hähnle authored
    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.
    Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
u_atomic.h 10 KB