--- src/gallium/auxiliary/os/os_thread.h | 51 ++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h index a084310..6c25b33 100644 --- a/src/gallium/auxiliary/os/os_thread.h +++ b/src/gallium/auxiliary/os/os_thread.h @@ -92,6 +92,23 @@ typedef pthread_mutex_t pipe_mutex; (void) pthread_mutex_unlock(&(mutex)) +/* pipe_spinlock + */ +typedef pthread_spinlock_t pipe_spinlock; + +#define pipe_spin_init(spinlock) \ + (void) pthread_spin_init(&(spinlock), 0) + +#define pipe_spin_destroy(spinlock) \ + (void) pthread_spin_destroy(&(spinlock)) + +#define pipe_spin_lock(spinlock) \ + (void) pthread_spin_lock(&(spinlock)) + +#define pipe_spin_unlock(spinlock) \ + (void) pthread_spin_unlock(&(spinlock)) + + /* pipe_condvar */ typedef pthread_cond_t pipe_condvar; @@ -167,6 +184,24 @@ typedef CRITICAL_SECTION pipe_mutex; #define pipe_mutex_unlock(mutex) \ LeaveCriticalSection(&mutex) + +/* pipe_spinlock (fake implemention for windows using mutex) + */ +typedef pipe_mutex pipe_spinlock; + +#define pipe_spin_init(spinlock) \ + pipe_mutex_init(spinlock) + +#define pipe_spin_destroy(spinlock) \ + pipe_mutex_destroy(spinlock) + +#define pipe_spin_lock(spinlock) \ + pipe_mutex_lock(spinlock) + +#define pipe_spin_unlock(spinlock) \ + pipe_mutex_unlock(spinlock) + + /* TODO: Need a macro to declare "I don't care about WinXP compatibilty" */ #if 0 && defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) /* CONDITION_VARIABLE is only available on newer versions of Windows @@ -272,6 +307,22 @@ typedef unsigned pipe_mutex; #define pipe_mutex_unlock(mutex) \ (void) mutex + +typedef unsigned pipe_spinlock; + +#define pipe_spin_init(spinlock) \ + (void) spinlock + +#define pipe_spin_destroy(spinlock) \ + (void) spinlock + +#define pipe_spin_lock(spinlock) \ + (void) spinlock + +#define pipe_spin_unlock(spinlock) \ + (void) spinlock + + typedef int64_t pipe_condvar; #define pipe_static_condvar(condvar) \ -- 1.7.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev