mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qemu-thread: Use futex if available for QemuLockCnt
This unlocks the futex-based implementation of QemuLockCnt to Windows. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Link: https://lore.kernel.org/r/20250529-event-v5-6-53b285203794@daynix.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
69e10db83e
commit
0a765ca850
2 changed files with 5 additions and 4 deletions
|
@ -17,7 +17,7 @@
|
|||
typedef struct QemuLockCnt QemuLockCnt;
|
||||
|
||||
struct QemuLockCnt {
|
||||
#ifndef CONFIG_LINUX
|
||||
#ifndef HAVE_FUTEX
|
||||
QemuMutex mutex;
|
||||
#endif
|
||||
unsigned count;
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
#include "qemu/atomic.h"
|
||||
#include "trace.h"
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
#include "qemu/futex.h"
|
||||
#ifdef HAVE_FUTEX
|
||||
|
||||
/* On Linux, bits 0-1 are a futex-based lock, bits 2-31 are the counter.
|
||||
/*
|
||||
* When futex is available, bits 0-1 are a futex-based lock, bits 2-31 are the
|
||||
* counter.
|
||||
* For the mutex algorithm see Ulrich Drepper's "Futexes Are Tricky" (ok,
|
||||
* this is not the most relaxing citation I could make...). It is similar
|
||||
* to mutex2 in the paper.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue