aboutsummaryrefslogtreecommitdiff
path: root/qemu-thread-posix.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-11-02 15:43:21 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2012-11-02 13:07:54 -0500
commitc166cb72f1676855816340666c3b618beef4b976 (patch)
tree25fb0c400c873eec5e3c9f4c3021c9a9d025b511 /qemu-thread-posix.h
parent1f001dc7bc9e435bf231a5b0edcad1c7c2bd6214 (diff)
downloadqemu-c166cb72f1676855816340666c3b618beef4b976.zip
qemu-c166cb72f1676855816340666c3b618beef4b976.tar.gz
qemu-c166cb72f1676855816340666c3b618beef4b976.tar.bz2
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 <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-thread-posix.h')
-rw-r--r--qemu-thread-posix.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/qemu-thread-posix.h b/qemu-thread-posix.h
index 2542c15..380bae2 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 {