]>
Commit | Line | Data |
---|---|---|
e5d355d1 AL |
1 | #ifndef __QEMU_THREAD_H |
2 | #define __QEMU_THREAD_H 1 | |
e5d355d1 | 3 | |
65097429 AL |
4 | #include <inttypes.h> |
5 | ||
e5d355d1 AL |
6 | typedef struct QemuMutex QemuMutex; |
7 | typedef struct QemuCond QemuCond; | |
8 | typedef struct QemuThread QemuThread; | |
9 | ||
9257d46d PB |
10 | #ifdef _WIN32 |
11 | #include "qemu-thread-win32.h" | |
12 | #else | |
13 | #include "qemu-thread-posix.h" | |
14 | #endif | |
15 | ||
cf218714 JK |
16 | #define QEMU_THREAD_JOINABLE 0 |
17 | #define QEMU_THREAD_DETACHED 1 | |
18 | ||
e5d355d1 | 19 | void qemu_mutex_init(QemuMutex *mutex); |
313b1d69 | 20 | void qemu_mutex_destroy(QemuMutex *mutex); |
e5d355d1 AL |
21 | void qemu_mutex_lock(QemuMutex *mutex); |
22 | int qemu_mutex_trylock(QemuMutex *mutex); | |
e5d355d1 AL |
23 | void qemu_mutex_unlock(QemuMutex *mutex); |
24 | ||
5f7d05ec HPB |
25 | #define rcu_read_lock() do { } while (0) |
26 | #define rcu_read_unlock() do { } while (0) | |
27 | ||
e5d355d1 | 28 | void qemu_cond_init(QemuCond *cond); |
313b1d69 | 29 | void qemu_cond_destroy(QemuCond *cond); |
9257d46d PB |
30 | |
31 | /* | |
32 | * IMPORTANT: The implementation does not guarantee that pthread_cond_signal | |
33 | * and pthread_cond_broadcast can be called except while the same mutex is | |
34 | * held as in the corresponding pthread_cond_wait calls! | |
35 | */ | |
e5d355d1 AL |
36 | void qemu_cond_signal(QemuCond *cond); |
37 | void qemu_cond_broadcast(QemuCond *cond); | |
38 | void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex); | |
e5d355d1 AL |
39 | |
40 | void qemu_thread_create(QemuThread *thread, | |
cf218714 JK |
41 | void *(*start_routine)(void *), |
42 | void *arg, int mode); | |
43 | void *qemu_thread_join(QemuThread *thread); | |
b7680cb6 JK |
44 | void qemu_thread_get_self(QemuThread *thread); |
45 | int qemu_thread_is_self(QemuThread *thread); | |
313b1d69 CC |
46 | void qemu_thread_exit(void *retval); |
47 | ||
e5d355d1 | 48 | #endif |