summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Krol <michal@tungstengraphics.com>2008-09-05 15:10:47 +0200
committerMichal Krol <michal@tungstengraphics.com>2008-09-05 15:10:47 +0200
commita0b5ac424b8bc310223137e7dc00d2eeeddb9ec6 (patch)
tree4850bb2478406aeef27f7439ca71e7cc008d243d /src
parentce3cf63251b9d0de1de066f71d0c642360215f13 (diff)
gallium: Add pipe_thread primitives for PIPE_SUBSYSTEM_WINDOWS_USER config.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/include/pipe/p_thread.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
index b3dfc91781..d4b1c3f486 100644
--- a/src/gallium/include/pipe/p_thread.h
+++ b/src/gallium/include/pipe/p_thread.h
@@ -85,6 +85,30 @@ typedef pthread_cond_t pipe_condvar;
#include <windows.h>
typedef HANDLE pipe_thread;
+
+#define PIPE_THREAD_ROUTINE( name, param ) \
+ void * WINAPI name( void *param )
+
+static INLINE pipe_thread pipe_thread_create( void *(WINAPI * routine)( void *), void *param )
+{
+ DWORD id;
+ return CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) routine, param, 0, &id );
+}
+
+static INLINE int pipe_thread_wait( pipe_thread thread )
+{
+ if (WaitForSingleObject( thread, INFINITE ) == WAIT_OBJECT_0)
+ return 0;
+ return -1;
+}
+
+static INLINE int pipe_thread_destroy( pipe_thread thread )
+{
+ if (CloseHandle( thread ))
+ return 0;
+ return -1;
+}
+
typedef CRITICAL_SECTION pipe_mutex;
#define pipe_static_mutex(name) \