mirror of https://github.com/mpv-player/mpv
compat: use __atomic operations instead of __sync, when present
Fixes #434 Fixes #437
This commit is contained in:
parent
e19060d89f
commit
4530d787d0
|
@ -19,5 +19,12 @@
|
||||||
// At this point both gcc and clang had __sync_synchronize support for some
|
// At this point both gcc and clang had __sync_synchronize support for some
|
||||||
// time. We only support a full memory barrier.
|
// time. We only support a full memory barrier.
|
||||||
|
|
||||||
#define mp_memory_barrier() __sync_synchronize()
|
#include "config.h"
|
||||||
#define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
|
|
||||||
|
#if HAVE_ATOMIC_BUILTINS
|
||||||
|
# define mp_memory_barrier() __atomic_thread_fence(__ATOMIC_SEQ_CST)
|
||||||
|
# define mp_atomic_add_and_fetch(a, b) __atomic_add_fetch(a, b,__ATOMIC_SEQ_CST)
|
||||||
|
#else
|
||||||
|
# define mp_memory_barrier() __sync_synchronize()
|
||||||
|
# define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue