aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/thread-posix.h
diff options
context:
space:
mode:
authorLongpeng(Mike) <longpeng2@huawei.com>2022-02-22 17:05:06 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2022-04-06 14:31:56 +0200
commita0d45db85496c195ab5f3f2ced742fc93d9709c2 (patch)
tree8e012af1385b943a3887bc62d29b8e4b880b96f2 /include/qemu/thread-posix.h
parent657ac98b58cee10e99c9d402bda4555fd0ec4d1f (diff)
downloadqemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.zip
qemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.tar.gz
qemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.tar.bz2
thread-posix: implement Semaphore with QemuCond and QemuMutex
Now that QemuSemaphore is implemented through pthread_cond_t only, we can use QemuCond and QemuMutex to make the code smaller. Features such as mutex tracing and CLOCK_MONOTONIC timedwait are supported in qemu-sem naturally. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Message-Id: <20220222090507.2028-4-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/thread-posix.h')
-rw-r--r--include/qemu/thread-posix.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h
index 5466608..5f2f3d1 100644
--- a/include/qemu/thread-posix.h
+++ b/include/qemu/thread-posix.h
@@ -27,10 +27,9 @@ struct QemuCond {
};
struct QemuSemaphore {
- pthread_mutex_t lock;
- pthread_cond_t cond;
+ QemuMutex mutex;
+ QemuCond cond;
unsigned int count;
- bool initialized;
};
struct QemuEvent {