[vlc-devel] commit: barrier(): issues a full memory barrier ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jul 5 13:20:25 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jul  5 14:07:45 2008 +0300| [06e3b333dcadd50c4e335337ac852918331499ca]

barrier(): issues a full memory barrier

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06e3b333dcadd50c4e335337ac852918331499ca
---

 include/vlc_threads.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 89e8ccc..5779ee8 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
  *****************************************************************************/




More information about the vlc-devel mailing list