-
Notifications
You must be signed in to change notification settings - Fork 15
/
thread.h
30 lines (22 loc) · 810 Bytes
/
thread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef THREAD_WIN32_STUFF_
#define THREAD_WIN32_STUFF_
#if defined(WINDOWS) || defined(WINDOWS64)
typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_init(m, p) InitializeCriticalSection(m)
#define pthread_mutex_lock(m) EnterCriticalSection(m)
#define pthread_mutex_unlock(m) LeaveCriticalSection(m)
#define pthread_mutex_destroy(m) DeleteCriticalSection(m)
#define PTH_SIGNAL 0
#define PTH_BROADCAST 1
#define PTH_MAX_EVENTS 2
typedef struct {
unsigned int count;
CRITICAL_SECTION lock;
HANDLE event;
} pthread_cond_t;
int pthread_cond_init(pthread_cond_t *cond, const void *attr);
int pthread_cond_wait_timeout(pthread_cond_t *cv, pthread_mutex_t *external_mutex, DWORD msec);
int pthread_cond_signal(pthread_cond_t *cv);
int pthread_cond_destroy(pthread_cond_t *cond);
#endif
#endif