[FFmpeg-cvslog] atomic: Check for __sync_val_compare_and_swap instead of __sync_synchronize

Martin Storsjö git at videolan.org
Tue Mar 12 10:49:25 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Mar  8 12:32:38 2013 +0200| [c48828f763672e45f0b1a20de41fb7ddd744462b] | committer: 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: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c48828f763672e45f0b1a20de41fb7ddd744462b
---

 configure          |    4 ++--
 libavutil/atomic.c |    4 ++--
 libavutil/atomic.h |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 1b1f6f8..cce71ab 100755
--- a/configure
+++ b/configure
@@ -1482,7 +1482,7 @@ HAVE_LIST="
     struct_v4l2_frmivalenum_discrete
     symver_asm_label
     symver_gnu_asm
-    sync_synchronize
+    sync_val_compare_and_swap
     sysconf
     sysctl
     sys_mman_h
@@ -3795,7 +3795,7 @@ check_func_headers malloc.h _aligned_malloc     && enable aligned_malloc
 check_func  setrlimit
 check_func  strerror_r
 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 MemoryBarrier windows.h "MemoryBarrier()"
 check_func  sysconf
diff --git a/libavutil/atomic.c b/libavutil/atomic.c
index 55abbab..7a701e1 100644
--- a/libavutil/atomic.c
+++ b/libavutil/atomic.c
@@ -20,7 +20,7 @@
 
 #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
 
@@ -102,7 +102,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
 
 #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
 #include <assert.h>
diff --git a/libavutil/atomic.h b/libavutil/atomic.h
index 14d334f..61512e0 100644
--- a/libavutil/atomic.h
+++ b/libavutil/atomic.h
@@ -25,7 +25,7 @@
 
 #if HAVE_MEMORYBARRIER
 #include "atomic_win32.h"
-#elif HAVE_SYNC_SYNCHRONIZE
+#elif HAVE_SYNC_VAL_COMPARE_AND_SWAP
 #include "atomic_gcc.h"
 #elif HAVE_MACHINE_RW_BARRIER
 #include "atomic_suncc.h"



More information about the ffmpeg-cvslog mailing list