summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe/p_thread.h
diff options
context:
space:
mode:
authorMichal Krol <michal@ubuntu-vbox.(none)>2008-09-05 16:47:06 +0200
committerMichal Krol <michal@ubuntu-vbox.(none)>2008-09-05 16:55:51 +0200
commit78a4589b10b765dfb2a5862f292e51e0f4b06dce (patch)
tree4a57072a8a98a7ec43977b173f5684742ea66030 /src/gallium/include/pipe/p_thread.h
parent0f6e76d7f1f46b76ae19b089596ba6770c31dc5a (diff)
gallium: Add pipe_thread primitives for PIPE_OS_LINUX.
Diffstat (limited to 'src/gallium/include/pipe/p_thread.h')
-rw-r--r--src/gallium/include/pipe/p_thread.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index d4b1c3f4869..e01d5a602b8 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -41,8 +41,29 @@
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
-
typedef pthread_t pipe_thread;
+
+#define PIPE_THREAD_ROUTINE( name, param ) \
+ void *name( void *param )
+
+static INLINE pipe_thread pipe_thread_create( void *(* routine)( void *), void *param )
+{
+ pipe_thread thread;
+ if (pthread_create( &thread, NULL, routine, param ))
+ return 0;
+ return thread;
+}
+
+static INLINE int pipe_thread_wait( pipe_thread thread )
+{
+ return pthread_join( thread, NULL );
+}
+
+static INLINE int pipe_thread_destroy( pipe_thread thread )
+{
+ return pthread_detach( thread );
+}
+
typedef pthread_mutex_t pipe_mutex;
typedef pthread_cond_t pipe_condvar;