summaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2025-10-01 15:15:15 +0000
committerJoseph Myers <josmyers@redhat.com>2025-10-01 15:15:15 +0000
commita7ddbf456d97ac8d1aa7afd735e196a1488bd874 (patch)
tree8bc64f54ded63bdb4902dcaf015acd17cf7f67e6 /manual
parent0f201f4a817e39c01c502f523d4ea3c91f242767 (diff)
Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23
C23 adds once_flag, ONCE_FLAG_INIT and call_once to stdlib.h (in C11 they were only in threads.h, in C23 they are in both headers; this change came from N2840). Implement this change, with a bits/types/once_flag.h header for the common type and initializer definitions. Note that there's an omnibus bug (bug 33001) that covers more than just these missing definitions. This doesn't seem a significant enough feature to be worth mentioning in NEWS. ISO C is not concerned with whether functions are in libc or libpthread, but POSIX links this to what header they are declared in, so functions declared in stdlib.h are supposed to be in libc. However, the current edition of POSIX is based on C17; hopefully Hurd glibc will have completed the merge of libpthread into libc (in particular, moving call_once) well before a future edition of POSIX based on C23 (or a later version of ISO C) is released. Tested for x86_64 and x86.
Diffstat (limited to 'manual')
-rw-r--r--manual/threads.texi3
1 files changed, 3 insertions, 0 deletions
diff --git a/manual/threads.texi b/manual/threads.texi
index eeefa9b800..1e9be32d66 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -219,6 +219,9 @@ invoked from several threads. The completion of the function
@code{call_once} with the same @code{flag} variable.
@end deftypefun
+These definitions are from C11, where they appear in @file{threads.h}.
+In C23, they appear in @file{stdlib.h} as well as in @file{threads.h}.
+
@node ISO C Mutexes
@subsection Mutexes