From 8df7e20788d201e6f031249563ba8a82eb4b4715 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 10 Feb 2010 18:12:10 -0800 Subject: 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 file changed, 52 insertions(+), 42 deletions(-) (limited to 'src/gallium/auxiliary/os/os_thread.h') diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h index 8ae90308c5..a04df4106f 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 /* -- cgit v1.2.3