mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
semaphore: implement fallback counting semaphores with mutex+condvar
OpenBSD and Darwin do not have sem_timedwait. Implement a fallback for them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
1f001dc7bc
commit
c166cb72f1
2 changed files with 87 additions and 9 deletions
|
@ -12,7 +12,13 @@ struct QemuCond {
|
|||
};
|
||||
|
||||
struct QemuSemaphore {
|
||||
#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
int count;
|
||||
#else
|
||||
sem_t sem;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct QemuThread {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue