]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/thread-posix.h
qsp: add sort_by option to qsp_report
[mirror_qemu.git] / include / qemu / thread-posix.h
CommitLineData
2a6a4076
MA
1#ifndef QEMU_THREAD_POSIX_H
2#define QEMU_THREAD_POSIX_H
a9c94277
MA
3
4#include <pthread.h>
38b14db3 5#include <semaphore.h>
9257d46d 6
feadec63
PB
7typedef QemuMutex QemuRecMutex;
8#define qemu_rec_mutex_destroy qemu_mutex_destroy
fe9959a2
EC
9#define qemu_rec_mutex_lock_impl qemu_mutex_lock_impl
10#define qemu_rec_mutex_trylock_impl qemu_mutex_trylock_impl
feadec63
PB
11#define qemu_rec_mutex_unlock qemu_mutex_unlock
12
9257d46d
PB
13struct QemuMutex {
14 pthread_mutex_t lock;
ba59fb77
PB
15#ifdef CONFIG_DEBUG_MUTEX
16 const char *file;
17 int line;
18#endif
c096358e 19 bool initialized;
9257d46d
PB
20};
21
22struct QemuCond {
23 pthread_cond_t cond;
c096358e 24 bool initialized;
9257d46d
PB
25};
26
38b14db3 27struct QemuSemaphore {
401bc051 28#ifndef CONFIG_SEM_TIMEDWAIT
c166cb72
PB
29 pthread_mutex_t lock;
30 pthread_cond_t cond;
79761c66 31 unsigned int count;
c166cb72 32#else
38b14db3 33 sem_t sem;
c166cb72 34#endif
c096358e 35 bool initialized;
38b14db3
PB
36};
37
c7c4d063
PB
38struct QemuEvent {
39#ifndef __linux__
40 pthread_mutex_t lock;
41 pthread_cond_t cond;
42#endif
43 unsigned value;
c096358e 44 bool initialized;
c7c4d063
PB
45};
46
9257d46d
PB
47struct QemuThread {
48 pthread_t thread;
49};
50
9257d46d 51#endif