futex: Support Windows
Windows supports futex-like APIs since Windows 8 and Windows Server 2012. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Link: https://lore.kernel.org/r/20250529-event-v5-2-53b285203794@daynix.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
6e2d11bf04
commit
1bc2c49539
6 changed files with 53 additions and 17 deletions
|
|
@ -106,7 +106,7 @@ static bool qemu_lockcnt_cmpxchg_or_wait(QemuLockCnt *lockcnt, int *val,
|
|||
static void lockcnt_wake(QemuLockCnt *lockcnt)
|
||||
{
|
||||
trace_lockcnt_futex_wake(lockcnt);
|
||||
qemu_futex_wake(&lockcnt->count, 1);
|
||||
qemu_futex_wake_single(&lockcnt->count);
|
||||
}
|
||||
|
||||
void qemu_lockcnt_inc(QemuLockCnt *lockcnt)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ else
|
|||
util_ss.add(files('event_notifier-win32.c'))
|
||||
util_ss.add(files('oslib-win32.c'))
|
||||
util_ss.add(files('qemu-thread-win32.c'))
|
||||
util_ss.add(winmm, pathcch)
|
||||
util_ss.add(winmm, pathcch, synchronization)
|
||||
endif
|
||||
util_ss.add(when: linux_io_uring, if_true: files('fdmon-io_uring.c'))
|
||||
if glib_has_gslice
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ static inline void qemu_futex_wait(QemuEvent *ev, unsigned val)
|
|||
|
||||
/* Valid transitions:
|
||||
* - free->set, when setting the event
|
||||
* - busy->set, when setting the event, followed by qemu_futex_wake
|
||||
* - busy->set, when setting the event, followed by qemu_futex_wake_all
|
||||
* - set->free, when resetting the event
|
||||
* - free->busy, when waiting
|
||||
*
|
||||
|
|
@ -400,7 +400,7 @@ void qemu_event_set(QemuEvent *ev)
|
|||
smp_mb__after_rmw();
|
||||
if (old == EV_BUSY) {
|
||||
/* There were waiters, wake them up. */
|
||||
qemu_futex_wake(ev, INT_MAX);
|
||||
qemu_futex_wake_all(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue