diff mbox series

[07/18] qemu-thread: Introduce QEMU_COND_INITIALIZER

Message ID 20240923162208.90745-8-iii@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Stop all qemu-cpu threads on a breakpoint | expand

Commit Message

Ilya Leoshkevich Sept. 23, 2024, 4:13 p.m. UTC
Allow static initialization of condition variables.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 include/qemu/thread-posix.h | 2 ++
 include/qemu/thread-win32.h | 2 ++
 2 files changed, 4 insertions(+)

Comments

Richard Henderson Oct. 5, 2024, 7:30 p.m. UTC | #1
On 9/23/24 09:13, Ilya Leoshkevich wrote:
> Allow static initialization of condition variables.
> 
> Signed-off-by: Ilya Leoshkevich<iii@linux.ibm.com>
> ---
>   include/qemu/thread-posix.h | 2 ++
>   include/qemu/thread-win32.h | 2 ++
>   2 files changed, 4 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h
index fc0846bfa7c..ed08181a9c6 100644
--- a/include/qemu/thread-posix.h
+++ b/include/qemu/thread-posix.h
@@ -32,6 +32,8 @@  struct QemuCond {
     bool initialized;
 };
 
+#define QEMU_COND_INITIALIZER {PTHREAD_COND_INITIALIZER, true}
+
 struct QemuSemaphore {
     QemuMutex mutex;
     QemuCond cond;
diff --git a/include/qemu/thread-win32.h b/include/qemu/thread-win32.h
index ed1f2d0e733..e1b014fcac4 100644
--- a/include/qemu/thread-win32.h
+++ b/include/qemu/thread-win32.h
@@ -29,6 +29,8 @@  struct QemuCond {
     bool initialized;
 };
 
+#define QEMU_COND_INITIALIZER {CONDITION_VARIABLE_INIT, true}
+
 struct QemuSemaphore {
     HANDLE sema;
     bool initialized;