hw/arm/xlnx-zynqmp.c: Avoid memory leak in error-return path
[qemu.git] / include / qemu / thread-posix.h
blobc903525062e298a2e3b42d78538a1d52f3f4ba1a
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_impl qemu_mutex_lock_impl
10 #define qemu_rec_mutex_trylock_impl qemu_mutex_trylock_impl
11 #define qemu_rec_mutex_unlock qemu_mutex_unlock
13 struct QemuMutex {
14 pthread_mutex_t lock;
15 #ifdef CONFIG_DEBUG_MUTEX
16 const char *file;
17 int line;
18 #endif
19 bool initialized;
22 struct QemuCond {
23 pthread_cond_t cond;
24 bool initialized;
27 struct QemuSemaphore {
28 #ifndef CONFIG_SEM_TIMEDWAIT
29 pthread_mutex_t lock;
30 pthread_cond_t cond;
31 unsigned int count;
32 #else
33 sem_t sem;
34 #endif
35 bool initialized;
38 struct QemuEvent {
39 #ifndef __linux__
40 pthread_mutex_t lock;
41 pthread_cond_t cond;
42 #endif
43 unsigned value;
44 bool initialized;
47 struct QemuThread {
48 pthread_t thread;
51 #endif