mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 03:52:22 +02:00
atomic: add atomic_exchange_explicit() fallback
Apparently I want to use this in a later commit. Untested, because this is a pre-C11 fallback, and I only test with real <stdatomic.h>.
This commit is contained in:
parent
50177aaa3b
commit
670610bc1d
@ -48,8 +48,7 @@ typedef struct { uint64_t v; } mp_atomic_uint64;
|
||||
|
||||
#define memory_order_relaxed 1
|
||||
#define memory_order_seq_cst 2
|
||||
|
||||
#define atomic_load_explicit(p, e) atomic_load(p)
|
||||
#define memory_order_acq_rel 3
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@ -99,6 +98,12 @@ extern pthread_mutex_t mp_atomic_mutex;
|
||||
pthread_mutex_unlock(&mp_atomic_mutex); \
|
||||
res_; })
|
||||
|
||||
#define atomic_load_explicit(a, b) \
|
||||
atomic_load(a)
|
||||
|
||||
#define atomic_exchange_explicit(a, b, c) \
|
||||
atomic_exchange(a, b)
|
||||
|
||||
#endif /* else HAVE_STDATOMIC */
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user