1 #ifndef QEMU_THREAD_POSIX_H 2 #define QEMU_THREAD_POSIX_H 3 4 #include <pthread.h> 5 #include <semaphore.h> 6 7 struct QemuMutex { 8 pthread_mutex_t lock; 9 }; 10 11 struct QemuCond { 12 pthread_cond_t cond; 13 }; 14 15 struct QemuSemaphore { 16 #if defined(__APPLE__) || defined(__NetBSD__) 17 pthread_mutex_t lock; 18 pthread_cond_t cond; 19 unsigned int count; 20 #else 21 sem_t sem; 22 #endif 23 }; 24 25 struct QemuEvent { 26 #ifndef __linux__ 27 pthread_mutex_t lock; 28 pthread_cond_t cond; 29 #endif 30 unsigned value; 31 }; 32 33 struct QemuThread { 34 pthread_t thread; 35 }; 36 37 #endif 38