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_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 12 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; 20 }; 21 22 struct QemuCond { 23 pthread_cond_t cond; 24 bool initialized; 25 }; 26 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; 36 }; 37 38 struct QemuEvent { 39 #ifndef __linux__ 40 pthread_mutex_t lock; 41 pthread_cond_t cond; 42 #endif 43 unsigned value; 44 bool initialized; 45 }; 46 47 struct QemuThread { 48 pthread_t thread; 49 }; 50 51 #endif 52