aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2025-05-29 14:45:55 +0900
committerPaolo Bonzini <pbonzini@redhat.com>2025-06-06 14:32:55 +0200
commit0a765ca850125e0202c366cb4aab032ac9670870 (patch)
tree25578e9dd939bbc75993e25cbb40b4acc0cfc683
parent69e10db83ea69cae74b59d27d87cfc61d9dd2b51 (diff)
downloadqemu-0a765ca850125e0202c366cb4aab032ac9670870.zip
qemu-0a765ca850125e0202c366cb4aab032ac9670870.tar.gz
qemu-0a765ca850125e0202c366cb4aab032ac9670870.tar.bz2
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>
-rw-r--r--include/qemu/lockcnt.h2
-rw-r--r--util/lockcnt.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/include/qemu/lockcnt.h b/include/qemu/lockcnt.h
index f4b62a3..5a2800e 100644
--- a/include/qemu/lockcnt.h
+++ b/include/qemu/lockcnt.h
@@ -17,7 +17,7 @@
typedef struct QemuLockCnt QemuLockCnt;
struct QemuLockCnt {
-#ifndef CONFIG_LINUX
+#ifndef HAVE_FUTEX
QemuMutex mutex;
#endif
unsigned count;
diff --git a/util/lockcnt.c b/util/lockcnt.c
index ca27d8e..92c9f8c 100644
--- a/util/lockcnt.c
+++ b/util/lockcnt.c
@@ -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.