diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-08-08 14:36:41 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-31 09:45:47 +0100 |
commit | 38b14db34e16bb0ae1f28b7ddccb6aa11a2a96a1 (patch) | |
tree | 13bfc5fc9a8c4f2a348a4ce61c57f1493f12c166 /qemu-thread-posix.h | |
parent | c90caf25e2b6945ae13560476a5ecd7992e9f945 (diff) |
qemu-thread: add QemuSemaphore
The new thread pool will use semaphores instead of condition
variables, because QemuCond does not have qemu_cond_timedwait.
(I also like it more this way).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-thread-posix.h')
-rw-r--r-- | qemu-thread-posix.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/qemu-thread-posix.h b/qemu-thread-posix.h index ee4618e620..2542c15200 100644 --- a/qemu-thread-posix.h +++ b/qemu-thread-posix.h @@ -1,6 +1,7 @@ #ifndef __QEMU_THREAD_POSIX_H #define __QEMU_THREAD_POSIX_H 1 #include "pthread.h" +#include <semaphore.h> struct QemuMutex { pthread_mutex_t lock; @@ -10,6 +11,10 @@ struct QemuCond { pthread_cond_t cond; }; +struct QemuSemaphore { + sem_t sem; +}; + struct QemuThread { pthread_t thread; }; |