1 #ifndef QEMU_THREAD_POSIX_H 2 #define QEMU_THREAD_POSIX_H 3 4 #include <pthread.h> 5 #include <semaphore.h> 6 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 12 13 struct QemuMutex { 14 pthread_mutex_t lock; 15 bool initialized; 16 }; 17 18 struct QemuCond { 19 pthread_cond_t cond; 20 bool initialized; 21 }; 22 23 struct QemuSemaphore { 24 #ifndef CONFIG_SEM_TIMEDWAIT 25 pthread_mutex_t lock; 26 pthread_cond_t cond; 27 unsigned int count; 28 #else 29 sem_t sem; 30 #endif 31 bool initialized; 32 }; 33 34 struct QemuEvent { 35 #ifndef __linux__ 36 pthread_mutex_t lock; 37 pthread_cond_t cond; 38 #endif 39 unsigned value; 40 bool initialized; 41 }; 42 43 struct QemuThread { 44 pthread_t thread; 45 }; 46 47 #endif 48