diff options
| author | Longpeng(Mike) | 2022-02-22 10:05:06 +0100 |
|---|---|---|
| committer | Paolo Bonzini | 2022-04-06 14:31:56 +0200 |
| commit | a0d45db85496c195ab5f3f2ced742fc93d9709c2 (patch) | |
| tree | 8e012af1385b943a3887bc62d29b8e4b880b96f2 /include | |
| parent | thread-posix: use monotonic clock for QemuCond and QemuSemaphore (diff) | |
| download | qemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.tar.gz qemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.tar.xz qemu-a0d45db85496c195ab5f3f2ced742fc93d9709c2.zip | |
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')
| -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 5466608d7c..5f2f3d1386 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 { |
