1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef _WINDOWS_COND_H
21 #define _WINDOWS_COND_H
22
23 #define WIN32_LEAN_AND_MEAN
24 #include <windows.h>
25
26 #include <time.h>
27
28 #include "windows-initguard.h"
29
30 #ifndef _glwthread_linked_waitqueue_link_defined
31 #define _glwthread_linked_waitqueue_link_defined
32 struct glwthread_waitqueue_link
33 {
34 struct glwthread_waitqueue_link *wql_next;
35 struct glwthread_waitqueue_link *wql_prev;
36 };
37 #endif
38
39 typedef struct
40 {
41 struct glwthread_waitqueue_link wq_list;
42 }
43 glwthread_linked_waitqueue_t;
44
45 typedef struct
46 {
47 glwthread_initguard_t guard;
48 CRITICAL_SECTION lock;
49 glwthread_linked_waitqueue_t waiters;
50 }
51 glwthread_cond_t;
52
53 #define GLWTHREAD_COND_INIT { GLWTHREAD_INITGUARD_INIT }
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 extern int glwthread_cond_init (glwthread_cond_t *cond);
60
61
62 extern int glwthread_cond_wait (glwthread_cond_t *cond,
63 void *mutex,
64 int (*mutex_lock) (void *),
65 int (*mutex_unlock) (void *));
66 extern int glwthread_cond_timedwait (glwthread_cond_t *cond,
67 void *mutex,
68 int (*mutex_lock) (void *),
69 int (*mutex_unlock) (void *),
70 const struct timespec *abstime);
71 extern int glwthread_cond_signal (glwthread_cond_t *cond);
72 extern int glwthread_cond_broadcast (glwthread_cond_t *cond);
73 extern int glwthread_cond_destroy (glwthread_cond_t *cond);
74
75 #ifdef __cplusplus
76 }
77 #endif
78
79 #endif