mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 10:01:59 -06:00
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>
This commit is contained in:
parent
657ac98b58
commit
a0d45db854
2 changed files with 34 additions and 76 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue