Commit e69ef500 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

vlc_threads: More barrier() support across toolchain and CPU.

parent c10a4dce
...@@ -567,10 +567,14 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin) ...@@ -567,10 +567,14 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin)
#endif #endif
static inline void barrier (void) static inline void barrier (void)
{ {
#if defined (__APPLE__) #if defined (__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
OSMemoryBarrier();
#elif defined (__GNUC__) /* FIXME: || defined (ICC_whatever) */
__sync_synchronize (); __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) #elif defined (LIBVLC_USE_PTHREAD)
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock (&lock); pthread_mutex_lock (&lock);
......
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