From: RĂ©mi Denis-Courmont Date: Sat, 5 Jul 2008 11:07:45 +0000 (+0300) Subject: barrier(): issues a full memory barrier X-Git-Tag: 0.9.0-test2~266 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=06e3b333dcadd50c4e335337ac852918331499ca;p=vlc barrier(): issues a full memory barrier --- diff --git a/include/vlc_threads.h b/include/vlc_threads.h index 89e8ccc488..5779ee8758 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -559,6 +559,22 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin) # define vlc_spin_destroy vlc_mutex_destroy #endif +/** + * Issues a full memory barrier. + */ +static inline void barrier (void) +{ +#if defined (__GNUC__) /* FIXME: || defined (ICC_whatever) */ + __sync_synchronize (); +#elif defined (LIBVLC_USE_PTHREAD) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_lock (&lock); + pthread_mutex_unlock (&lock); +#else +# error barrier not implemented! +#endif +} + /***************************************************************************** * vlc_thread_create: create a thread *****************************************************************************/