Merge remote-tracking branch 'remotes/dgibson/tags/submodule-update-20170303' into...
[qemu/ar7.git] / include / qemu / thread-posix.h
blob09d1e157286183916611d6fc380c97b39e890acf
1 #ifndef QEMU_THREAD_POSIX_H
2 #define QEMU_THREAD_POSIX_H
4 #include <pthread.h>
5 #include <semaphore.h>
7 typedef QemuMutex QemuRecMutex;
8 #define qemu_rec_mutex_destroy qemu_mutex_destroy
9 #define qemu_rec_mutex_lock qemu_mutex_lock
10 #define qemu_rec_mutex_try_lock qemu_mutex_try_lock
11 #define qemu_rec_mutex_unlock qemu_mutex_unlock
13 struct QemuMutex {
14 pthread_mutex_t lock;
17 struct QemuCond {
18 pthread_cond_t cond;
21 struct QemuSemaphore {
22 #if defined(__APPLE__) || defined(__NetBSD__)
23 pthread_mutex_t lock;
24 pthread_cond_t cond;
25 unsigned int count;
26 #else
27 sem_t sem;
28 #endif
31 struct QemuEvent {
32 #ifndef __linux__
33 pthread_mutex_t lock;
34 pthread_cond_t cond;
35 #endif
36 unsigned value;
39 struct QemuThread {
40 pthread_t thread;
43 #endif