summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-12-11 14:07:01 -0700
committerBrian Paul <[email protected]>2009-12-11 14:07:27 -0700
commit24d894e5579bd11fdf294d86834093e353abf4db (patch)
treeeae7d91fc6d9b2d1117a1e6124173ef72d4d56cc /src/gallium
parent0fc90dfa280e12a100c6c7c632d5d29c16118c9a (diff)
gallium: comments and minor re-org in p_thread.h
There's more work to do in this file: 1. Implement condvars for Windows via Win32 CONDITION_VARIABLE type. 2. Implement barriers for Windows 3. Try to get rid of PIPE_THREAD_HAVE_CONDVAR (only used in trace driver) 4. Why the 2 in _P_THREAD2_H_?
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/include/pipe/p_thread.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index ba5cd589f84..8119c1f571c 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -47,6 +47,8 @@
#define PIPE_THREAD_HAVE_CONDVAR
+/* pipe_thread
+ */
typedef pthread_t pipe_thread;
#define PIPE_THREAD_ROUTINE( name, param ) \
@@ -70,8 +72,10 @@ static INLINE int pipe_thread_destroy( pipe_thread thread )
return pthread_detach( thread );
}
+
+/* pipe_mutex
+ */
typedef pthread_mutex_t pipe_mutex;
-typedef pthread_cond_t pipe_condvar;
#define pipe_static_mutex(mutex) \
static pipe_mutex mutex = PTHREAD_MUTEX_INITIALIZER
@@ -88,6 +92,11 @@ typedef pthread_cond_t pipe_condvar;
#define pipe_mutex_unlock(mutex) \
(void) pthread_mutex_unlock(&(mutex))
+
+/* pipe_condvar
+ */
+typedef pthread_cond_t pipe_condvar;
+
#define pipe_static_condvar(mutex) \
static pipe_condvar mutex = PTHREAD_COND_INITIALIZER
@@ -107,6 +116,8 @@ 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)
@@ -129,6 +140,8 @@ static INLINE void pipe_barrier_wait(pipe_barrier *barrier)
#include <windows.h>
+/* pipe_thread
+ */
typedef HANDLE pipe_thread;
#define PIPE_THREAD_ROUTINE( name, param ) \
@@ -154,6 +167,9 @@ static INLINE int pipe_thread_destroy( pipe_thread thread )
return -1;
}
+
+/* pipe_mutex
+ */
typedef CRITICAL_SECTION pipe_mutex;
#define pipe_static_mutex(mutex) \
@@ -171,17 +187,29 @@ typedef CRITICAL_SECTION pipe_mutex;
#define pipe_mutex_unlock(mutex) \
LeaveCriticalSection(&mutex)
-/* XXX: dummy definitions, make it compile */
+/* pipe_condvar (XXX FIX THIS)
+ */
typedef unsigned pipe_condvar;
-#define pipe_condvar_init(condvar) \
- (void) condvar
+#define pipe_condvar_init(cond) \
+ (void) cond
-#define pipe_condvar_broadcast(condvar) \
- (void) condvar
+#define pipe_condvar_destroy(cond) \
+ (void) cond
+
+#define pipe_condvar_wait(cond, mutex) \
+ (void) cond; (void) mutex
+
+#define pipe_condvar_signal(cond) \
+ (void) cond
+
+#define pipe_condvar_broadcast(cond) \
+ (void) cond
+/* pipe_barrier (XXX FIX THIS)
+ */
typedef unsigned pipe_barrier;
static INLINE void pipe_barrier_init(pipe_barrier *barrier, unsigned count)