-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwindows_wait_event.c
More file actions
49 lines (41 loc) · 1.05 KB
/
windows_wait_event.c
File metadata and controls
49 lines (41 loc) · 1.05 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <windows.h>
#include "wait_event.h"
struct wait_event {
HANDLE wait_event;
};
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
int size_of_wait_event(void){
return sizeof(struct wait_event);
}
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
void create_wait_event(struct wait_event *wait_event) {
wait_event->wait_event = CreateEvent(NULL, TRUE, TRUE, NULL);
}
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
void pause_if_necessary(struct wait_event *wait_event){
WaitForSingleObject(wait_event->wait_event, INFINITE);
}
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
void set_pause(struct wait_event *wait_event) {
ResetEvent(wait_event->wait_event);
}
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
void resume_from_pause(struct wait_event *wait_event) {
SetEvent(wait_event->wait_event);
}
#if __GNUC__ >= 4
__attribute__ ((visibility ("hidden")))
#endif
void destroy_wait_event(struct wait_event *wait_event) {
CloseHandle(wait_event->wait_event);
}