From c166cb72f1676855816340666c3b618beef4b976 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 2 Nov 2012 15:43:21 +0100 Subject: semaphore: implement fallback counting semaphores with mutex+condvar OpenBSD and Darwin do not have sem_timedwait. Implement a fallback for them. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- qemu-thread-posix.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qemu-thread-posix.h') diff --git a/qemu-thread-posix.h b/qemu-thread-posix.h index 2542c15200..380bae209b 100644 --- a/qemu-thread-posix.h +++ b/qemu-thread-posix.h @@ -12,7 +12,13 @@ struct QemuCond { }; struct QemuSemaphore { +#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) + pthread_mutex_t lock; + pthread_cond_t cond; + int count; +#else sem_t sem; +#endif }; struct QemuThread { -- cgit v1.2.1