From d9e8ef7f66cbe1352a6e3df9ed2a1d76b3813ff3 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 10 Apr 2023 11:50:33 -0400 Subject: [PATCH] threads.h: Fix value of ONCE_FLAG_INIT. Fixes #18348. --- headers/posix/threads.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/headers/posix/threads.h b/headers/posix/threads.h index 58658e5d68..f1aea87b81 100644 --- a/headers/posix/threads.h +++ b/headers/posix/threads.h @@ -63,7 +63,7 @@ enum { #if !defined(__cplusplus) || __cplusplus < 201103L #define thread_local _Thread_local #endif -#define ONCE_FLAG_INIT { 0 } +#define ONCE_FLAG_INIT { -1 } #define TSS_DTOR_ITERATIONS 4 #ifdef __cplusplus @@ -89,8 +89,7 @@ int thrd_create(thrd_t *thread, thrd_start_t, void *); thrd_t thrd_current(void); int thrd_detach(thrd_t); int thrd_equal(thrd_t, thrd_t); -_Noreturn void - thrd_exit(int); +void thrd_exit(int) __attribute__((noreturn)); int thrd_join(thrd_t, int *); int thrd_sleep(const struct timespec *, struct timespec *); void thrd_yield(void);