aboutsummaryrefslogtreecommitdiff
path: root/qemu-thread.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-08-08 14:36:41 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-10-31 09:45:47 +0100
commit38b14db34e16bb0ae1f28b7ddccb6aa11a2a96a1 (patch)
tree13bfc5fc9a8c4f2a348a4ce61c57f1493f12c166 /qemu-thread.h
parentc90caf25e2b6945ae13560476a5ecd7992e9f945 (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.h')
-rw-r--r--qemu-thread.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-thread.h b/qemu-thread.h
index 05fdaaf50e..3ee2f6b1f9 100644
--- a/qemu-thread.h
+++ b/qemu-thread.h
@@ -6,6 +6,7 @@
typedef struct QemuMutex QemuMutex;
typedef struct QemuCond QemuCond;
+typedef struct QemuSemaphore QemuSemaphore;
typedef struct QemuThread QemuThread;
#ifdef _WIN32
@@ -38,6 +39,12 @@ void qemu_cond_signal(QemuCond *cond);
void qemu_cond_broadcast(QemuCond *cond);
void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
+void qemu_sem_init(QemuSemaphore *sem, int init);
+void qemu_sem_post(QemuSemaphore *sem);
+void qemu_sem_wait(QemuSemaphore *sem);
+int qemu_sem_timedwait(QemuSemaphore *sem, int ms);
+void qemu_sem_destroy(QemuSemaphore *sem);
+
void qemu_thread_create(QemuThread *thread,
void *(*start_routine)(void *),
void *arg, int mode);