gallium: Add pipe_thread primitives for PIPE_OS_LINUX.
authorMichal Krol <michal@ubuntu-vbox.(none)>
Fri, 5 Sep 2008 14:47:06 +0000 (16:47 +0200)
committerMichal Krol <michal@ubuntu-vbox.(none)>
Fri, 5 Sep 2008 14:55:51 +0000 (16:55 +0200)
src/gallium/include/pipe/p_thread.h

index d4b1c3f..e01d5a6 100644 (file)
 #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;