From: Michal Krol Date: Fri, 5 Sep 2008 14:47:06 +0000 (+0200) Subject: gallium: Add pipe_thread primitives for PIPE_OS_LINUX. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78a4589b10b765dfb2a5862f292e51e0f4b06dce;p=mesa.git gallium: Add pipe_thread primitives for PIPE_OS_LINUX. --- 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 /* POSIX threads headers */ #include /* 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;