summaryrefslogtreecommitdiffstats
path: root/src/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.h')
-rw-r--r--src/thread.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/thread.h b/src/thread.h
index 23e4510..2aadc6e 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -28,6 +28,9 @@
28#include <windows.h> 28#include <windows.h>
29typedef HANDLE THREAD_T; 29typedef HANDLE THREAD_T;
30typedef CRITICAL_SECTION mutex_t; 30typedef CRITICAL_SECTION mutex_t;
31typedef struct {
32 HANDLE sem;
33} cond_t;
31typedef volatile struct { 34typedef volatile struct {
32 LONG lock; 35 LONG lock;
33 int state; 36 int state;
@@ -38,8 +41,10 @@ typedef volatile struct {
38#else 41#else
39#include <pthread.h> 42#include <pthread.h>
40#include <signal.h> 43#include <signal.h>
44#include <sys/time.h>
41typedef pthread_t THREAD_T; 45typedef pthread_t THREAD_T;
42typedef pthread_mutex_t mutex_t; 46typedef pthread_mutex_t mutex_t;
47typedef pthread_cond_t cond_t;
43typedef pthread_once_t thread_once_t; 48typedef pthread_once_t thread_once_t;
44#define THREAD_ONCE_INIT PTHREAD_ONCE_INIT 49#define THREAD_ONCE_INIT PTHREAD_ONCE_INIT
45#define THREAD_ID pthread_self() 50#define THREAD_ID pthread_self()
@@ -73,4 +78,10 @@ void mutex_unlock(mutex_t* mutex);
73 78
74void thread_once(thread_once_t *once_control, void (*init_routine)(void)); 79void thread_once(thread_once_t *once_control, void (*init_routine)(void));
75 80
81void cond_init(cond_t* cond);
82void cond_destroy(cond_t* cond);
83int cond_signal(cond_t* cond);
84int cond_wait(cond_t* cond, mutex_t* mutex);
85int cond_wait_timeout(cond_t* cond, mutex_t* mutex, unsigned int timeout_ms);
86
76#endif 87#endif