[vlc-devel] commit: vlc_threads: More barrier() support across toolchain and CPU. ( Pierre d'Herbemont )
git version control
git at videolan.org
Sat Jul 5 21:25:42 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jul 5 21:27:00 2008 +0200| [e69ef5000b2b39ef65843a771f3dfeee52b2de7d]
vlc_threads: More barrier() support across toolchain and CPU.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e69ef5000b2b39ef65843a771f3dfeee52b2de7d
---
include/vlc_threads.h | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index a31f004..2ce2302 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -567,10 +567,14 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin)
#endif
static inline void barrier (void)
{
-#if defined (__APPLE__)
- OSMemoryBarrier();
-#elif defined (__GNUC__) /* FIXME: || defined (ICC_whatever) */
+#if defined (__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
__sync_synchronize ();
+#elif defined(__APPLE__)
+ OSMemoryBarrier ();
+#elif defined(__powerpc__)
+ asm volatile ("sync":::"memory");
+#elif defined(__i386__)
+ asm volatile ("mfence":::"memory");
#elif defined (LIBVLC_USE_PTHREAD)
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock (&lock);
More information about the vlc-devel
mailing list