]> git.proxmox.com Git - mirror_qemu.git/blob - include/qemu/thread-win32.h
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[mirror_qemu.git] / include / qemu / thread-win32.h
1 #ifndef QEMU_THREAD_WIN32_H
2 #define QEMU_THREAD_WIN32_H
3
4 #include <windows.h>
5
6 struct QemuMutex {
7 SRWLOCK lock;
8 #ifdef CONFIG_DEBUG_MUTEX
9 const char *file;
10 int line;
11 #endif
12 bool initialized;
13 };
14
15 typedef struct QemuRecMutex QemuRecMutex;
16 struct QemuRecMutex {
17 CRITICAL_SECTION lock;
18 bool initialized;
19 };
20
21 void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
22 void qemu_rec_mutex_lock(QemuRecMutex *mutex);
23 int qemu_rec_mutex_trylock(QemuRecMutex *mutex);
24 void qemu_rec_mutex_unlock(QemuRecMutex *mutex);
25
26 struct QemuCond {
27 CONDITION_VARIABLE var;
28 bool initialized;
29 };
30
31 struct QemuSemaphore {
32 HANDLE sema;
33 bool initialized;
34 };
35
36 struct QemuEvent {
37 int value;
38 HANDLE event;
39 bool initialized;
40 };
41
42 typedef struct QemuThreadData QemuThreadData;
43 struct QemuThread {
44 QemuThreadData *data;
45 unsigned tid;
46 };
47
48 /* Only valid for joinable threads. */
49 HANDLE qemu_thread_get_handle(QemuThread *thread);
50
51 #endif