diff options
| author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2025-05-26 14:29:13 +0900 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-06-06 14:32:55 +0200 |
| commit | d1895f4c17fdeee35a9b86099bb64d4ed3333658 (patch) | |
| tree | 96204afec0eba65e348c79458452b0d3f5d7c5ca /util/qemu-thread-win32.c | |
| parent | 32da70a88780a167affde071fb2410ca2da58eaa (diff) | |
| download | focaccia-qemu-d1895f4c17fdeee35a9b86099bb64d4ed3333658.tar.gz focaccia-qemu-d1895f4c17fdeee35a9b86099bb64d4ed3333658.zip | |
qemu-thread: Avoid futex abstraction for non-Linux
qemu-thread used to abstract pthread primitives into futex for the QemuEvent implementation of POSIX systems other than Linux. However, this abstraction has one key difference: unlike futex, pthread primitives require an explicit destruction, and it must be ordered after wait and wake operations. It would be easier to perform destruction if a wait operation ensures the corresponding wake operation finishes as POSIX semaphore does, but that requires to protect state accesses in qemu_event_set() and qemu_event_wait() with a mutex. On the other hand, real futex does not need such a protection but needs complex barrier and atomic operations to ensure ordering between the two functions. Add special implementations of qemu_event_set() and qemu_event_wait() using pthread primitives. qemu_event_wait() will ensure qemu_event_set() finishes, and these functions will avoid complex barrier and atomic operations to ensure ordering between them. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu> Link: https://lore.kernel.org/r/20250526-event-v4-5-5b784cc8e1de@daynix.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/qemu-thread-win32.c')
0 files changed, 0 insertions, 0 deletions