Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / include / pipe / p_thread.h
index 4325abc951edd93e6fe5e7a2b78db68024f3e348..6e526b7aa8b9373f96d1c09132e6b82147c4ce63 100644 (file)
 #define _P_THREAD_H_
 
 
-#if defined(USE_MGL_NAMESPACE)
-#define _glapi_Dispatch _mglapi_Dispatch
-#endif
-
-
-
 #if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\
      defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \
     && !defined(THREADS)
@@ -114,6 +108,26 @@ typedef pthread_mutex_t _glthread_Mutex;
 #define _glthread_UNLOCK_MUTEX(name) \
    (void) pthread_mutex_unlock(&(name))
 
+typedef pthread_cond_t _glthread_Cond;
+
+#define _glthread_DECLARE_STATIC_COND(name) \
+   static _glthread_Cond name = PTHREAD_COND_INITIALIZER
+
+#define _glthread_INIT_COND(cond)                      \
+   pthread_cond_init(&(cond), NULL)
+
+#define _glthread_DESTROY_COND(name) \
+   pthread_cond_destroy(&(name))
+
+#define _glthread_COND_WAIT(cond, mutex) \
+  pthread_cond_wait(&(cond), &(mutex))
+
+#define _glthread_COND_SIGNAL(cond) \
+  pthread_cond_signal(&(cond))
+
+#define _glthread_COND_BROADCAST(cond) \
+  pthread_cond_broadcast(&(cond))
+
 #endif /* PTHREADS */
 
 
@@ -273,6 +287,20 @@ typedef unsigned _glthread_Mutex;
 
 #define _glthread_UNLOCK_MUTEX(name)  (void) name
 
+typedef unsigned _glthread_Cond;
+
+#define _glthread_DECLARE_STATIC_COND(name) static _glthread_Cond name = 0
+
+#define _glthread_INIT_COND(name)  (void) name
+
+#define _glthread_DESTROY_COND(name)  (void) name
+
+#define _glthread_COND_WAIT(name, mutex)  (void) name
+
+#define _glthread_COND_SIGNAL(name)  (void) name
+
+#define _glthread_COND_BROADCAST(name)  (void) name
+
 #endif /* THREADS */
 
 
@@ -296,22 +324,6 @@ _glthread_GetTSD(_glthread_TSD *);
 extern void
 _glthread_SetTSD(_glthread_TSD *, void *);
 
-#if defined(GLX_USE_TLS)
-
-extern __thread struct _glapi_table * _glapi_tls_Dispatch
-    __attribute__((tls_model("initial-exec")));
-
-#define GET_DISPATCH() _glapi_tls_Dispatch
-
-#elif !defined(GL_CALL)
-# if defined(THREADS)
-#  define GET_DISPATCH() \
-   ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
-       ? _glapi_Dispatch : _glapi_get_dispatch())
-# else
-#  define GET_DISPATCH() _glapi_Dispatch
-# endif /* defined(THREADS) */
-#endif  /* ndef GL_CALL */
 
 
 #endif /* _P_THREAD_H_ */