summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-05 21:14:58 +0100
committerwm4 <wm4@nowhere>2020-03-05 22:00:50 +0100
commit670610bc1d9429e150872c6be3ff399da01a87a0 (patch)
tree12427f508534a94c06e145cc597c419af766a965 /osdep
parent50177aaa3b2040cc76d59b2e19687d9016641c39 (diff)
downloadmpv-670610bc1d9429e150872c6be3ff399da01a87a0.tar.bz2
mpv-670610bc1d9429e150872c6be3ff399da01a87a0.tar.xz
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>.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/atomic.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/osdep/atomic.h b/osdep/atomic.h
index 0c4de4b578..774924afa2 100644
--- a/osdep/atomic.h
+++ b/osdep/atomic.h
@@ -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