diff options
author | Longpeng(Mike) <longpeng2@huawei.com> | 2022-02-22 17:05:06 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-06 14:31:56 +0200 |
commit | a0d45db85496c195ab5f3f2ced742fc93d9709c2 (patch) | |
tree | 8e012af1385b943a3887bc62d29b8e4b880b96f2 /include/qemu/thread-posix.h | |
parent | 657ac98b58cee10e99c9d402bda4555fd0ec4d1f (diff) | |
download | qemu-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.h | 5 |
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 { |