Mesa (master): os: Do not use Pthreads barrier functions on Mac OS X.

Vinson Lee vlee at kemper.freedesktop.org
Thu Feb 11 02:15:13 UTC 2010


Module: Mesa
Branch: master
Commit: 8df7e20788d201e6f031249563ba8a82eb4b4715
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8df7e20788d201e6f031249563ba8a82eb4b4715

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Feb 10 18:12:10 2010 -0800

os: Do not use Pthreads barrier functions on Mac OS X.

Pthreads barrier functions are not available on some POSIX platforms.

---

 src/gallium/auxiliary/os/os_thread.h |   94 +++++++++++++++++++---------------
 1 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 8ae9030..a04df41 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -116,25 +116,6 @@ typedef pthread_cond_t pipe_condvar;
   pthread_cond_broadcast(&(cond))
 
 
-/* pipe_barrier
- */
-typedef pthread_barrier_t pipe_barrier;
-
-static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
-{
-   pthread_barrier_init(barrier, NULL, count);
-}
-
-static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
-{
-   pthread_barrier_destroy(barrier);
-}
-
-static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
-{
-   pthread_barrier_wait(barrier);
-}
-
 
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
 
@@ -208,26 +189,6 @@ typedef unsigned pipe_condvar;
    (void) cond
 
 
-/* pipe_barrier (XXX FIX THIS)
- */
-typedef unsigned pipe_barrier;
-
-static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
-{
-   /* XXX we could implement barriers with a mutex and condition var */
-}
-
-static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
-{
-}
-
-static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
-{
-   assert(0);
-}
-
-
-
 #else
 
 /** Dummy definitions */
@@ -254,7 +215,6 @@ static INLINE int pipe_thread_destroy( pipe_thread thread )
 
 typedef unsigned pipe_mutex;
 typedef unsigned pipe_condvar;
-typedef unsigned pipe_barrier;
 
 #define pipe_static_mutex(mutex) \
    static pipe_mutex mutex = 0
@@ -290,6 +250,57 @@ typedef unsigned pipe_barrier;
    (void) condvar
 
 
+#endif  /* PIPE_OS_? */
+
+
+/*
+ * pipe_barrier
+ */
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
+
+typedef pthread_barrier_t pipe_barrier;
+
+static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
+{
+   pthread_barrier_init(barrier, NULL, count);
+}
+
+static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
+{
+   pthread_barrier_destroy(barrier);
+}
+
+static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
+{
+   pthread_barrier_wait(barrier);
+}
+
+
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+
+/* XXX FIX THIS */
+typedef unsigned pipe_barrier;
+
+static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
+{
+   /* XXX we could implement barriers with a mutex and condition var */
+}
+
+static INLINE void pipe_barrier_destroy(pipe_barrier *barrier)
+{
+}
+
+static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
+{
+   assert(0);
+}
+
+
+#else
+
+typedef unsigned pipe_barrier;
+
 static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
 {
    /* XXX we could implement barriers with a mutex and condition var */
@@ -307,8 +318,7 @@ static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
 }
 
 
-
-#endif  /* PIPE_OS_? */
+#endif
 
 
 /*




More information about the mesa-commit mailing list