Commit c48828f7 authored by Martin Storsjö's avatar Martin Storsjö Committed by Michael Niedermayer

atomic: Check for __sync_val_compare_and_swap instead of __sync_synchronize

Not all gcc configurations have an implementation of all the atomic
operations, and some gcc configurations have some atomic builtins
implemented but not all.

Thus check for the most essential function, whose presence should
indicate that all others are present as well, since it can be used
to implement all the other ones.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent c5362538
...@@ -1482,7 +1482,7 @@ HAVE_LIST=" ...@@ -1482,7 +1482,7 @@ HAVE_LIST="
struct_v4l2_frmivalenum_discrete struct_v4l2_frmivalenum_discrete
symver_asm_label symver_asm_label
symver_gnu_asm symver_gnu_asm
sync_synchronize sync_val_compare_and_swap
sysconf sysconf
sysctl sysctl
sys_mman_h sys_mman_h
...@@ -3795,7 +3795,7 @@ check_func_headers malloc.h _aligned_malloc && enable aligned_malloc ...@@ -3795,7 +3795,7 @@ check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
check_func setrlimit check_func setrlimit
check_func strerror_r check_func strerror_r
check_func sched_getaffinity check_func sched_getaffinity
check_builtin sync_synchronize "" "__sync_synchronize()" check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()" check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
check_builtin MemoryBarrier windows.h "MemoryBarrier()" check_builtin MemoryBarrier windows.h "MemoryBarrier()"
check_func sysconf check_func sysconf
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "atomic.h" #include "atomic.h"
#if !HAVE_MEMORYBARRIER && !HAVE_SYNC_SYNCHRONIZE && !HAVE_MACHINE_RW_BARRIER #if !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER
#if HAVE_PTHREADS #if HAVE_PTHREADS
...@@ -102,7 +102,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval) ...@@ -102,7 +102,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
#endif /* HAVE_PTHREADS */ #endif /* HAVE_PTHREADS */
#endif /* !HAVE_MEMORYBARRIER && !HAVE_SYNC_SYNCHRONIZE && !HAVE_MACHINE_RW_BARRIER */ #endif /* !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER */
#ifdef TEST #ifdef TEST
#include <assert.h> #include <assert.h>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#if HAVE_MEMORYBARRIER #if HAVE_MEMORYBARRIER
#include "atomic_win32.h" #include "atomic_win32.h"
#elif HAVE_SYNC_SYNCHRONIZE #elif HAVE_SYNC_VAL_COMPARE_AND_SWAP
#include "atomic_gcc.h" #include "atomic_gcc.h"
#elif HAVE_MACHINE_RW_BARRIER #elif HAVE_MACHINE_RW_BARRIER
#include "atomic_suncc.h" #include "atomic_suncc.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment