mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-04-28 06:33:36 +00:00
doc: be more like POSIX in threading terms
In documentation and comments, be more like POSIX in terminology involving multithreading. Explain the distinction between multithreaded process vs multithreaded program. Change “program” to “process” when the latter wording is more accurate or informative. Simplify the wording for the constraints on processes that use unlocked I/O. Change “multithread-safe” to “thread-safe”. Change “thread-safety” to “thread safety”. However, do not change “multithreaded” to “multi-threaded” even though there are some uses of both spellinga, as there are a whole bunch of uses of “multithreaded”, also in identifier names; perhaps Gnulib should even standardize on “multithreaded” (not “multi-threaded”), contra POSIX.
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
||||
2026-04-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
doc: be more like POSIX in threading terms
|
||||
In documentation and comments, be more like POSIX in terminology
|
||||
involving multithreading. Explain the distinction between
|
||||
multithreaded process vs multithreaded program. Change “program”
|
||||
to “process” when the latter wording is more accurate or informative.
|
||||
Simplify the wording for the constraints on processes that use
|
||||
unlocked I/O. Change “multithread-safe” to “thread-safe”.
|
||||
Change “thread-safety” to “thread safety”.
|
||||
However, do not change “multithreaded” to “multi-threaded” even
|
||||
though there are some uses of both spellinga, as there are a whole
|
||||
bunch of uses of “multithreaded”, also in identifier names;
|
||||
perhaps Gnulib should even standardize on “multithreaded”
|
||||
(not “multi-threaded”), contra POSIX.
|
||||
|
||||
2026-04-10 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
fenv-exceptions-trapping tests: Make test more debugging friendly.
|
||||
|
||||
@@ -24,4 +24,4 @@ when the current locale's notion of decimal point is a comma @samp{,},
|
||||
and no characters outside the basic character set are accepted.
|
||||
|
||||
On platforms without @code{strtod_l}, this function is not safe for use in
|
||||
multi-threaded applications since it calls @code{setlocale}.
|
||||
multi-threaded processes since it calls @code{setlocale}.
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
@node Multithreading
|
||||
@chapter Multithreading
|
||||
|
||||
Multithreading is a programming paradigm. In a multithreaded program,
|
||||
multiple threads execute concurrently (or quasi concurrently) at different
|
||||
places in the program.
|
||||
Multithreading is a programming paradigm. In a @dfn{multithreaded
|
||||
process}, multiple threads execute concurrently (or quasi
|
||||
concurrently) at different places in the program, and a
|
||||
@dfn{multithreaded program} is one that contains primitives that can
|
||||
create threads. In contrast, a @dfn{single-threaded process} has just
|
||||
one thread, and a @dfn{single-threaded program} contains no
|
||||
multithreading primitives and so executes entirely in its process's
|
||||
main thread.
|
||||
|
||||
There are three motivations for using multithreading in a program:
|
||||
@itemize @bullet
|
||||
@@ -290,10 +295,8 @@ if (mt) gl_lock_unlock (some_lock);
|
||||
You may use the @code{unlocked-io} module if you want the @code{FILE} stream
|
||||
functions @code{getc}, @code{putc}, etc.@: to use unlocked I/O if available,
|
||||
throughout the package. Unlocked I/O can improve performance, sometimes
|
||||
dramatically. But unlocked I/O is safe only in single-threaded programs,
|
||||
as well as in multithreaded programs for which you can guarantee that
|
||||
every @code{FILE} stream, including @code{stdin}, @code{stdout}, @code{stderr},
|
||||
is used only in a single thread.
|
||||
dramatically. But unlocked I/O is safe only in processes in which
|
||||
two threads never simultaneously access the same @code{FILE} stream.
|
||||
|
||||
You need extra code for this optimization to be effective: include the
|
||||
@code{"unlocked-io.h"} header file. Some Gnulib modules that do operations
|
||||
|
||||
@@ -620,7 +620,7 @@ avoid a conflict with the alternative Posix function @code{getdate},
|
||||
and a later rename to @code{parse_datetime}. The Posix function
|
||||
@code{getdate} can parse more locale-specific dates using
|
||||
@code{strptime}, but relies on an environment variable and external
|
||||
file, and lacks the thread-safety of @code{parse_datetime}.
|
||||
file, and lacks the thread safety of @code{parse_datetime}.
|
||||
|
||||
@cindex Pinard, F.
|
||||
@cindex Berry, K.
|
||||
|
||||
@@ -15,7 +15,7 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on many non-glibc platforms:
|
||||
glibc 2.9, macOS 14, FreeBSD 6.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.3, Cygwin 1.7.1, mingw, MSVC 14, Android 4.4.
|
||||
But the replacement function is not atomic; this matters in multi-threaded
|
||||
programs that spawn child processes.
|
||||
processes that spawn child processes.
|
||||
@end itemize
|
||||
|
||||
Portability problems not fixed by Gnulib:
|
||||
|
||||
@@ -17,7 +17,7 @@ This function has no impact if @code{SIGALRM} is inherited as
|
||||
ignored; programs should use @code{signal (SIGALRM, SIG_DFL)} if
|
||||
it is important to ensure the alarm will fire.
|
||||
@item
|
||||
Use of this function in multi-threaded applications is not advised.
|
||||
Use of this function in multi-threaded programs is not advised.
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
mingw (2011), MSVC 14.
|
||||
|
||||
@@ -25,7 +25,7 @@ The replacement does not always take ACLs into account.
|
||||
@item
|
||||
The replacement is not safe to be used in libraries.
|
||||
@item
|
||||
The replacement is not multithread-safe.
|
||||
The replacement is not thread-safe.
|
||||
@item
|
||||
The replacement does not support the @code{AT_SYMLINK_NOFOLLOW} flag,
|
||||
which is supported by GNU @code{faccessat}.
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and is not
|
||||
thread-safe.
|
||||
@end itemize
|
||||
|
||||
Portability problems not fixed by Gnulib:
|
||||
|
||||
@@ -13,7 +13,8 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and is not
|
||||
thread-safe.
|
||||
@item
|
||||
This function does not fail when the file name argument ends in a slash
|
||||
and (without the slash) names a non-directory, on some platforms:
|
||||
|
||||
@@ -14,7 +14,7 @@ This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not multithread-safe. Also, the replacement may fail to change
|
||||
is not thread-safe. Also, the replacement may fail to change
|
||||
symlinks if @code{lchown} is unsupported, or fail altogether if
|
||||
@code{chown} is unsupported.
|
||||
@item
|
||||
|
||||
@@ -14,7 +14,7 @@ This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not multithread-safe. Also, the replacement does not guarantee
|
||||
is not thread-safe. Also, the replacement does not guarantee
|
||||
that @samp{dirfd(fdopendir(n))==n} (dirfd might fail, or return a
|
||||
different file descriptor than n).
|
||||
@item
|
||||
|
||||
@@ -13,7 +13,8 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and is not
|
||||
thread-safe.
|
||||
@item
|
||||
On platforms where @code{off_t} is a 32-bit type, @code{fstatat} may
|
||||
not correctly report the size of files or block devices larger than 2
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.9, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.4.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
This function fails to directly hardlink symlinks on some platforms:
|
||||
Mac OS X 10.10.
|
||||
|
||||
@@ -13,7 +13,8 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@end itemize
|
||||
|
||||
Portability problems not fixed by Gnulib:
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, macOS 12, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 5.1.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
This function does not fail when the file name argument ends in a slash
|
||||
and (without the slash) names a nonexistent file, on some platforms:
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, macOS 12, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.4.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
This function does not fail when the file name argument ends in a slash
|
||||
and (without the slash) names a nonexistent file, on some platforms:
|
||||
|
||||
@@ -28,7 +28,7 @@ The constants @code{ERA}, @code{ERA_D_FMT}, @code{ERA_D_T_FMT},
|
||||
@code{ERA_T_FMT}, @code{ALT_DIGITS} are not supported on some platforms:
|
||||
OpenBSD 7.5.
|
||||
@item
|
||||
This function is not multithread-safe on some platforms:
|
||||
This function is not thread-safe on some platforms:
|
||||
macOS 26, Solaris 11.3.
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
Some platforms do not support @code{O_CLOEXEC}:
|
||||
AIX 7.1, Solaris 10.
|
||||
|
||||
@@ -15,7 +15,7 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on many non-glibc platforms:
|
||||
glibc 2.8, macOS 14, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.3, Cygwin 1.7.1, mingw, MSVC 14, Android 2.2.
|
||||
But the replacement function is not atomic; this matters in multi-threaded
|
||||
programs that spawn child processes.
|
||||
processes that spawn child processes.
|
||||
@end itemize
|
||||
|
||||
Portability problems not fixed by Gnulib:
|
||||
|
||||
@@ -10,7 +10,7 @@ Gnulib module: rand
|
||||
Portability problems fixed by Gnulib:
|
||||
@itemize
|
||||
@item
|
||||
This function crashes when used in multithreaded programs on some platforms:
|
||||
This function crashes when used in multithreaded processes on some platforms:
|
||||
CheriBSD.
|
||||
@end itemize
|
||||
|
||||
@@ -20,6 +20,6 @@ Portability problems not fixed by Gnulib:
|
||||
This function is only defined as an inline function on some platforms:
|
||||
Android 4.4.
|
||||
@item
|
||||
This function is not multithread-safe on some platforms:
|
||||
This function is not thread-safe on some platforms:
|
||||
musl libc, macOS 14, FreeBSD 13.2, NetBSD 10.0, AIX 7.1, Solaris 11.4.
|
||||
@end itemize
|
||||
|
||||
@@ -16,7 +16,7 @@ mingw, MSVC 14.
|
||||
This function is only defined as an inline function on some platforms:
|
||||
Android 4.4.
|
||||
@item
|
||||
This function is not multithread-safe on some platforms:
|
||||
This function is not thread-safe on some platforms:
|
||||
macOS 14, FreeBSD 13.2, Solaris 11.4, Cygwin 3.4.6, Haiku.
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.9, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.4.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
Some platforms mistakenly succeed on file names ending in @file{/}:
|
||||
macOS 14.
|
||||
|
||||
@@ -13,7 +13,7 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not
|
||||
multithread-safe.
|
||||
thread-safe.
|
||||
@item
|
||||
This function is declared in @code{<unistd.h>}, not in @code{<stdio.h>},
|
||||
on some platforms:
|
||||
|
||||
@@ -34,10 +34,10 @@ always fails. The replacement, however, supports only the locale names
|
||||
Portability problems fixed by Gnulib module @code{setlocale} or @code{setlocale-null}:
|
||||
@itemize
|
||||
@item
|
||||
Invocations of @code{setlocale (..., NULL)} are not multithread-safe on some
|
||||
Invocations of @code{setlocale (..., NULL)} are not thread-safe on some
|
||||
platforms:
|
||||
musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin.
|
||||
To make these invocations multithread-safe, you need the Gnulib module
|
||||
To make these invocations thread-safe, you need the Gnulib module
|
||||
@code{setlocale}, or you need to change the code to invoke @code{setlocale_null}
|
||||
or @code{setlocale_null_r} instead.
|
||||
@end itemize
|
||||
|
||||
@@ -22,7 +22,7 @@ In case of failure, the return value is wrong on some platforms:
|
||||
NetBSD 10.0 when libpthread is in use.
|
||||
|
||||
@item
|
||||
POSIX says that in multi-threaded programs @code{sigprocmask} has
|
||||
POSIX says that in multi-threaded processes @code{sigprocmask} has
|
||||
unspecified behavior so @code{pthread_sigmask} should be used instead.
|
||||
On most platforms, @code{sigprocmask} is essentially equivalent to
|
||||
@code{pthread_sigmask}, with only a difference regarding the error
|
||||
@@ -38,7 +38,7 @@ The Gnulib replacement on native MS-Windows is not async-signal-safe
|
||||
POSIX section ``Signal Actions''}).
|
||||
@end itemize
|
||||
|
||||
Note: In single-threaded applications it's simpler to use
|
||||
Note: In single-threaded programs it's simpler to use
|
||||
@code{sigprocmask}, since it does not require compiling with
|
||||
@code{-pthread} and/or linking with @code{-lpthread} on some platforms:
|
||||
AIX.
|
||||
|
||||
@@ -93,4 +93,4 @@ Portability problems not fixed by Gnulib:
|
||||
Note: Gnulib has a module @code{xstrerror}, with the property that
|
||||
@code{xstrerror (NULL, errnum)} returns the value of @code{strerror_r}
|
||||
as a freshly allocated string.
|
||||
(Recall that the expression @code{strerror (errnum)} is not multithread-safe.)
|
||||
(Recall that the expression @code{strerror (errnum)} is not thread-safe.)
|
||||
|
||||
@@ -12,7 +12,8 @@ Portability problems fixed by Gnulib:
|
||||
@item
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.4.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
Some platforms declare this function in @code{stdio.h} instead of
|
||||
@code{unistd.h}:
|
||||
|
||||
@@ -13,7 +13,8 @@ Portability problems fixed by Gnulib:
|
||||
This function is missing on some platforms:
|
||||
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
|
||||
AIX 5.1, HP-UX 11, Cygwin 1.5.x, mingw, MSVC 14.
|
||||
But the replacement function is not safe to be used in libraries and is not multithread-safe.
|
||||
But the replacement function is not safe to be used in libraries and
|
||||
is not thread-safe.
|
||||
@item
|
||||
This function is declared in @code{<fcntl.h>}, not in @code{<unistd.h>},
|
||||
on some platforms:
|
||||
|
||||
@@ -15,7 +15,7 @@ glibc 2.5, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX
|
||||
However, the replacement function may end up truncating timestamps to
|
||||
worse resolution than supported by the file system. Furthermore, the
|
||||
replacement function is not safe to be used in libraries and is not
|
||||
multithread-safe.
|
||||
thread-safe.
|
||||
@item
|
||||
This function returns a bogus value instead of failing with
|
||||
@code{ENOSYS} on some platforms:
|
||||
|
||||
@@ -43,7 +43,7 @@ AIX 7.3, HP-UX 11, Solaris 11.4, mingw, MSVC 14.
|
||||
On some platforms the global state variables @code{daylight},
|
||||
@code{timezone} and @code{tzname} are not available. Even on
|
||||
platforms where they are available, their contents are often unreliable,
|
||||
even in single-threaded programs.
|
||||
even in single-threaded processes.
|
||||
Portable code can instead use @code{struct tm}'s @code{tm_gmtoff} and
|
||||
@code{tm_zone} members when available, and the @code{strftime} function
|
||||
with @code{%z} or @code{%Z} conversion specifiers otherwise.
|
||||
|
||||
@@ -40,6 +40,6 @@ Hence if you need more than one thing quoted at the same time, you
|
||||
need to use @code{quote_n}.
|
||||
|
||||
@findex quotearg_alloc
|
||||
Also, the @code{quote} module is not suited for multithreaded applications.
|
||||
Also, the @code{quote} module is not suited for multithreaded processes.
|
||||
In that case, you have to use @code{quotearg_alloc}, defined in the
|
||||
@samp{quotearg} module, which is decidedly less convenient.
|
||||
|
||||
@@ -34,7 +34,7 @@ extern "C" {
|
||||
The difference can matter in GNU/Linux, where times in /proc/stat
|
||||
might be relative to boot time of the host, not the container.
|
||||
|
||||
This function is not multithread-safe, since on many platforms it
|
||||
This function is not thread-safe, since on many platforms it
|
||||
invokes the functions setutxent, getutxent, endutxent.
|
||||
These functions may lock a file like /var/log/wtmp (so that we
|
||||
don't read garbage when a concurrent process writes to that file),
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
(e.g., with malloc). Yes, this is a pain, but we don't know of any
|
||||
better solution that is portable.
|
||||
|
||||
No attempt has been made to deal with multithreaded applications. */
|
||||
No attempt has been made to deal with multithreaded processes. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
@@ -79,10 +79,10 @@ static char
|
||||
decimal_point_char (void)
|
||||
{
|
||||
const char *point;
|
||||
/* Determine it in a multithread-safe way. We know nl_langinfo is
|
||||
multithread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
|
||||
localeconv() is rarely multithread-safe. */
|
||||
/* Determine it in a thread-safe way. We know nl_langinfo is
|
||||
thread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be thread-safe by POSIX. sprintf(), however, is thread-safe.
|
||||
localeconv() is rarely thread-safe. */
|
||||
# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
|
||||
point = nl_langinfo (RADIXCHAR);
|
||||
# elif 1
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
/* The results of openat() in this file are not leaked to any
|
||||
single-threaded code that could use stdio.
|
||||
FIXME - if the kernel ever adds support for multi-thread safety for
|
||||
FIXME - if the kernel ever adds support for thread safety for
|
||||
avoiding standard fds, then we should use openat_safer. */
|
||||
|
||||
struct cd_buf
|
||||
|
||||
@@ -51,7 +51,7 @@ struct all_tempdirs
|
||||
extern struct all_tempdirs dir_cleanup_list;
|
||||
|
||||
/* A file descriptor to be closed.
|
||||
In multithreaded programs, it is forbidden to close the same fd twice,
|
||||
In multithreaded processes, it is forbidden to close the same fd twice,
|
||||
because you never know what unrelated open() calls are being executed in
|
||||
other threads. So, the 'close (fd)' must be guarded by a once-only guard. */
|
||||
struct closeable_fd
|
||||
|
||||
@@ -59,8 +59,8 @@ extern "C" {
|
||||
Limitations: Files or directories can still be left over if
|
||||
- the program dies from a fatal signal such as SIGQUIT, SIGKILL, or
|
||||
SIGABRT, SIGSEGV, SIGBUS, SIGILL, SIGFPE, or
|
||||
- in a multithreaded program, the fatal signal handler is already running
|
||||
while another thread of the program creates a new temporary directory
|
||||
- in a multithreaded process, the fatal signal handler is already running
|
||||
while another thread of the process creates a new temporary directory
|
||||
or temporary file, or
|
||||
- on native Windows, some temporary files are used by a subprocess while
|
||||
the fatal signal interrupts the program.
|
||||
|
||||
@@ -56,7 +56,7 @@ rpl_ctime (const time_t *tp)
|
||||
const char *tz = getenv ("TZ");
|
||||
if (tz != NULL && strchr (tz, '/') != NULL)
|
||||
{
|
||||
/* Neutralize it, in a way that is multithread-safe.
|
||||
/* Neutralize it, in a way that is thread-safe.
|
||||
(If we were to use _putenv ("TZ="), it would free the memory allocated
|
||||
for the environment variable "TZ", and thus other threads that are
|
||||
using the previously fetched value of getenv ("TZ") could crash.) */
|
||||
|
||||
@@ -85,7 +85,7 @@ static int fatal_signals[] =
|
||||
static void
|
||||
init_fatal_signals (void)
|
||||
{
|
||||
/* This function is multithread-safe even without synchronization, because
|
||||
/* This function is thread-safe even without synchronization, because
|
||||
if two threads execute it simultaneously, the fatal_signals[] array will
|
||||
not change any more after the first of the threads has completed this
|
||||
function. */
|
||||
@@ -199,7 +199,7 @@ install_handlers (void)
|
||||
}
|
||||
|
||||
|
||||
/* Lock that makes at_fatal_signal multi-thread safe. */
|
||||
/* Lock that makes at_fatal_signal thread-safe. */
|
||||
gl_lock_define_initialized (static, at_fatal_signal_lock)
|
||||
|
||||
/* Register a cleanup function to be executed when a catchable fatal signal
|
||||
|
||||
@@ -77,7 +77,7 @@ rpl_fclose (FILE *fp)
|
||||
overridden close() function invokes. See lib/close.c. */
|
||||
#if WINDOWS_SOCKETS
|
||||
/* Call the overridden close(), then the original fclose().
|
||||
Note about multithread-safety: There is a race condition where some
|
||||
Note about thread safety: There is a race condition where some
|
||||
other thread could open fd between our close and fclose. */
|
||||
if (close (fd) < 0 && saved_errno == 0)
|
||||
saved_errno = errno;
|
||||
@@ -89,7 +89,7 @@ rpl_fclose (FILE *fp)
|
||||
/* Call fclose() and invoke all hooks of the overridden close(). */
|
||||
|
||||
# if REPLACE_FCHDIR
|
||||
/* Note about multithread-safety: There is a race condition here as well.
|
||||
/* Note about thread safety: There is a race condition here as well.
|
||||
Some other thread could open fd between our calls to fclose and
|
||||
_gl_unregister_fd. */
|
||||
result = fclose_nothrow (fp);
|
||||
|
||||
@@ -258,7 +258,7 @@ file_is_remote (const char *file)
|
||||
#else /* Unknown OS */
|
||||
# if defined SLOW_AND_OVERKILL
|
||||
/* This makes many system calls, is therefore slow, and
|
||||
is also not multithread-safe. */
|
||||
is also not thread-safe. */
|
||||
struct stat statbuf;
|
||||
if (stat (file, &statbuf) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
/* Because fstrcmp is typically called multiple times, attempt to minimize
|
||||
the number of memory allocations performed. Thus, let a call reuse the
|
||||
memory already allocated by the previous call, if it is sufficient.
|
||||
To make it multithread-safe, without need for a lock that protects the
|
||||
To make it thread-safe, without need for a lock that protects the
|
||||
already allocated memory, store the allocated memory per thread. Free
|
||||
it only when the thread exits. */
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
/* The results of opendir() in this file are not used with dirfd and fchdir,
|
||||
and we do not leak fds to any single-threaded code that could use stdio,
|
||||
therefore save some unnecessary recursion in fchdir.c.
|
||||
FIXME - if the kernel ever adds support for multi-thread safety for
|
||||
FIXME - if the kernel ever adds support for thread safety for
|
||||
avoiding standard fds, then we should use opendir_safer and
|
||||
openat_safer. */
|
||||
#ifdef GNULIB_defined_DIR
|
||||
|
||||
@@ -111,7 +111,7 @@ getlogin_r (char *name, size_t size)
|
||||
char tty[1024];
|
||||
if (ttyname_r (STDIN_FILENO, tty, sizeof (tty)) == 0)
|
||||
{
|
||||
/* We cannot use read_utmp here, since it is not multithread-safe. */
|
||||
/* We cannot use read_utmp here, since it is not thread-safe. */
|
||||
/* Fallback for systems which don't maintain an utmp database
|
||||
or for ttys that are not recorded in that the utmp database:
|
||||
Look at the owner of that tty. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Retrieve the umask of the process (multithread-safe).
|
||||
/* Retrieve the umask of the process (thread-safe).
|
||||
Copyright (C) 2020-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -26,7 +26,7 @@
|
||||
Each has its drawbacks:
|
||||
(a) Causes additional system calls. May fail in some rare cases.
|
||||
(b) Causes globally visible code complexity / maintainer effort.
|
||||
(c) Is not multithread-safe: open() calls in other threads may
|
||||
(c) Is not thread-safe: open() calls in other threads may
|
||||
create files with wrong access permissions.
|
||||
|
||||
Here we implement (a), as the least evil. */
|
||||
@@ -51,7 +51,7 @@ mode_t
|
||||
getumask (void)
|
||||
{
|
||||
#if 0
|
||||
/* This is not multithread-safe! */
|
||||
/* This is not thread-safe! */
|
||||
mode_t mask = umask (0);
|
||||
umask (mask);
|
||||
return mask;
|
||||
|
||||
@@ -157,7 +157,7 @@ extern int glthread_in_use (void);
|
||||
that libpthread would not be loaded after libintl; i.e. if libintl is
|
||||
loaded first, by an executable that does not depend on libpthread, and
|
||||
then a module is dynamically loaded that depends on libpthread, libintl
|
||||
will not be multithread-safe. */
|
||||
will not be thread-safe. */
|
||||
|
||||
/* The way to test at runtime whether libpthread is present is to test
|
||||
whether a function pointer's value, such as &pthread_mutex_init, is
|
||||
|
||||
@@ -110,7 +110,7 @@ extern int glthread_in_use (void);
|
||||
that libpthread would not be loaded after libintl; i.e. if libintl is
|
||||
loaded first, by an executable that does not depend on libpthread, and
|
||||
then a module is dynamically loaded that depends on libpthread, libintl
|
||||
will not be multithread-safe. */
|
||||
will not be thread-safe. */
|
||||
|
||||
/* The way to test at runtime whether libpthread is present is to test
|
||||
whether a function pointer's value, such as &pthread_mutex_init, is
|
||||
|
||||
@@ -162,7 +162,7 @@ extern int glthread_in_use (void);
|
||||
that libpthread would not be loaded after libintl; i.e. if libintl is
|
||||
loaded first, by an executable that does not depend on libpthread, and
|
||||
then a module is dynamically loaded that depends on libpthread, libintl
|
||||
will not be multithread-safe. */
|
||||
will not be thread-safe. */
|
||||
|
||||
/* The way to test at runtime whether libpthread is present is to test
|
||||
whether a function pointer's value, such as &pthread_mutex_init, is
|
||||
|
||||
@@ -62,7 +62,7 @@ extern "C" {
|
||||
As explained above, this approach has uncontrollable dangers for
|
||||
security.
|
||||
|
||||
This approach is normally not usable in multithreaded programs, because
|
||||
This approach is normally not usable in multithreaded processes, because
|
||||
you cannot know what kind of system calls the other threads could be
|
||||
doing during the time the privileges are enabled.
|
||||
|
||||
|
||||
@@ -781,7 +781,7 @@ static const struct table_entry locale_table[] =
|
||||
The result must not be freed; it is statically allocated. The result
|
||||
becomes invalid when setlocale() is used to change the global locale, or
|
||||
when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
|
||||
is changed; threads in multithreaded programs should not do this.
|
||||
is changed; threads in multithreaded processes should not do this.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
@@ -793,7 +793,7 @@ locale_charset (void)
|
||||
{
|
||||
const char *codeset;
|
||||
|
||||
/* This function must be multithread-safe. To achieve this without using
|
||||
/* This function must be thread-safe. To achieve this without using
|
||||
thread-local storage, we use a simple strcpy or memcpy to fill this static
|
||||
buffer. Filling it through, for example, strcpy + strcat would not be
|
||||
guaranteed to leave the buffer's contents intact if another thread is
|
||||
@@ -839,7 +839,7 @@ locale_charset (void)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (resultbuf))
|
||||
{
|
||||
/* This way of filling resultbuf is multithread-safe. */
|
||||
/* This way of filling resultbuf is thread-safe. */
|
||||
memcpy (resultbuf, dot, modifier - dot);
|
||||
resultbuf [modifier - dot] = '\0';
|
||||
return resultbuf;
|
||||
@@ -940,7 +940,7 @@ locale_charset (void)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (resultbuf))
|
||||
{
|
||||
/* This way of filling resultbuf is multithread-safe. */
|
||||
/* This way of filling resultbuf is thread-safe. */
|
||||
memcpy (resultbuf, dot, modifier - dot);
|
||||
resultbuf [modifier - dot] = '\0';
|
||||
return resultbuf;
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
The result must not be freed; it is statically allocated. The result
|
||||
becomes invalid when setlocale() is used to change the global locale, or
|
||||
when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
|
||||
is changed; threads in multithreaded programs should not do this.
|
||||
is changed; threads in multithreaded processes should not do this.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
@@ -56,7 +56,7 @@ rpl_localtime (const time_t *tp)
|
||||
const char *tz = getenv ("TZ");
|
||||
if (tz != NULL && strchr (tz, '/') != NULL)
|
||||
{
|
||||
/* Neutralize it, in a way that is multithread-safe.
|
||||
/* Neutralize it, in a way that is thread-safe.
|
||||
(If we were to use _putenv ("TZ="), it would free the memory allocated
|
||||
for the environment variable "TZ", and thus other threads that are
|
||||
using the previously fetched value of getenv ("TZ") could crash.) */
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
if (enc == enc_utf8) /* UTF-8 */
|
||||
{
|
||||
/* Achieve
|
||||
- multi-thread safety and
|
||||
- thread safety and
|
||||
- the ability to produce wide character values > WCHAR_MAX
|
||||
by not calling mbtowc() at all. */
|
||||
#include "mbrtowc-impl-utf8.h"
|
||||
@@ -87,7 +87,7 @@
|
||||
else
|
||||
{
|
||||
/* The hidden internal state of mbtowc would make this function not
|
||||
multi-thread safe. Achieve multi-thread safety through a lock. */
|
||||
thread-safe. Achieve thread safety through a lock. */
|
||||
{
|
||||
wchar_t wc;
|
||||
res = mbtowc_with_lock (&wc, p, m);
|
||||
|
||||
@@ -75,7 +75,7 @@ extern "C" {
|
||||
|
||||
/* Ensure that the invalid parameter handler in installed that just returns.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
invalid parameter handler, this solution is thread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
@@ -112,7 +112,7 @@ extern void gl_msvc_inval_ensure_handler (void);
|
||||
/* A compiler that supports __try/__except, as described in the page
|
||||
"try-except statement" on microsoft.com
|
||||
<https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement>.
|
||||
With __try/__except, we can use the multithread-safe exception handling. */
|
||||
With __try/__except, we can use the thread-safe exception handling. */
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -121,7 +121,7 @@ extern "C" {
|
||||
/* Ensure that the invalid parameter handler in installed that raises a
|
||||
software exception with code STATUS_GNULIB_INVALID_PARAMETER.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
invalid parameter handler, this solution is thread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
@@ -166,7 +166,7 @@ struct gl_msvc_inval_per_thread
|
||||
control to the gl_msvc_inval_restart if it is valid, or raises a
|
||||
software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
invalid parameter handler, this solution is thread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
/* Return a pointer to the per-thread data for the current thread. */
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
/* nl_langinfo() must be multithread-safe. To achieve this without using
|
||||
/* nl_langinfo() must be thread-safe. To achieve this without using
|
||||
thread-local storage:
|
||||
1. We use a specific static buffer for each possible argument.
|
||||
So that different threads can call nl_langinfo with different arguments,
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Note: The functions declared in this file are NOT multithread-safe. */
|
||||
/* Note: The functions declared in this file are NOT thread-safe. */
|
||||
|
||||
|
||||
/* Free a memory block.
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/* The following is identical to the function from glibc's
|
||||
sysdeps/posix/pread.c */
|
||||
|
||||
/* Note: This implementation of pread is not multithread-safe. */
|
||||
/* Note: This implementation of pread is not thread-safe. */
|
||||
|
||||
ssize_t
|
||||
pread (int fd, void *buf, size_t nbyte, off_t offset)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define __set_errno(Val) errno = (Val)
|
||||
#define __libc_write(f,b,n) write (f, b, n)
|
||||
|
||||
/* Note: This implementation of pwrite is not multithread-safe. */
|
||||
/* Note: This implementation of pwrite is not thread-safe. */
|
||||
|
||||
ssize_t
|
||||
pwrite (int fd, const void *buf, size_t nbyte, off_t offset)
|
||||
|
||||
@@ -330,7 +330,7 @@ char *extract_trimmed_name (const STRUCT_UTMP *ut)
|
||||
If OPTIONS & READ_UTMP_NO_BOOT_TIME is nonzero, omit the boot time
|
||||
entries.
|
||||
|
||||
This function is not multithread-safe, since on many platforms it
|
||||
This function is not thread-safe, since on many platforms it
|
||||
invokes the functions setutxent, getutxent, endutxent. These
|
||||
functions are needed because they may lock FILE (so that we don't
|
||||
read garbage when a concurrent process writes to FILE), but their
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
/* The results of opendir() in this file are not used with dirfd and fchdir,
|
||||
and we do not leak fds to any single-threaded code that could use stdio,
|
||||
therefore save some unnecessary recursion in fchdir.c and opendir_safer.c.
|
||||
FIXME - if the kernel ever adds support for multi-thread safety for
|
||||
FIXME - if the kernel ever adds support for thread safety for
|
||||
avoiding standard fds, then we should use opendir_safer. */
|
||||
# ifdef GNULIB_defined_DIR
|
||||
# undef DIR
|
||||
|
||||
@@ -42,7 +42,7 @@ setlocale_messages (const char *name)
|
||||
const char *
|
||||
setlocale_messages_null (void)
|
||||
{
|
||||
/* This implementation is multithread-safe, assuming no other thread changes
|
||||
/* This implementation is thread-safe, assuming no other thread changes
|
||||
the LC_MESSAGES locale category. */
|
||||
return lc_messages_name;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ setlocale_fixed (int category, const char *name)
|
||||
const char *
|
||||
setlocale_fixed_null (int category)
|
||||
{
|
||||
/* This implementation is multithread-safe, assuming no other thread changes
|
||||
/* This implementation is thread-safe, assuming no other thread changes
|
||||
any locale category. */
|
||||
if (category == LC_ALL)
|
||||
return lc_all_name;
|
||||
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
extern const char *setlocale_messages (const char *name);
|
||||
|
||||
/* setlocale_messages_null () is like setlocale (LC_MESSAGES, NULL), except that
|
||||
it is guaranteed to be multithread-safe. */
|
||||
it is guaranteed to be thread-safe. */
|
||||
extern const char *setlocale_messages_null (void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ extern void gl_locale_name_canonicalize (char *name);
|
||||
# error "This file should only be compiled if NEED_SETLOCALE_IMPROVED || NEED_SETLOCALE_MTSAFE."
|
||||
# endif
|
||||
|
||||
/* Like setlocale, but guaranteed to be multithread-safe if LOCALE == NULL. */
|
||||
/* Like setlocale, but guaranteed to be thread-safe if LOCALE == NULL. */
|
||||
# if !SETLOCALE_NULL_ALL_MTSAFE || !SETLOCALE_NULL_ONE_MTSAFE /* i.e. if NEED_SETLOCALE_MTSAFE */
|
||||
|
||||
# if NEED_SETLOCALE_IMPROVED
|
||||
|
||||
@@ -189,7 +189,7 @@ setlocale_null (int category)
|
||||
return setlocale_null_unlocked (category);
|
||||
#else
|
||||
|
||||
/* This call must be multithread-safe. To achieve this without using
|
||||
/* This call must be thread-safe. To achieve this without using
|
||||
thread-local storage:
|
||||
1. We use a specific static buffer for each possible CATEGORY
|
||||
argument. So that different threads can call setlocale_mtsafe
|
||||
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
CATEGORY is invalid, or ERANGE if BUFSIZE is smaller than the length needed
|
||||
size (including the trailing NUL byte). In the latter case, a truncated
|
||||
result is returned in BUF, but still NUL-terminated if BUFSIZE > 0.
|
||||
This call is guaranteed to be multithread-safe only if
|
||||
This call is guaranteed to be thread-safe only if
|
||||
- CATEGORY != LC_ALL and SETLOCALE_NULL_ONE_MTSAFE is true, or
|
||||
- CATEGORY == LC_ALL and SETLOCALE_NULL_ALL_MTSAFE is true,
|
||||
and the other threads must not make other setlocale invocations (since
|
||||
@@ -65,7 +65,7 @@ extern int setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
|
||||
|
||||
/* setlocale_null_unlocked (CATEGORY) is like setlocale (CATEGORY, NULL).
|
||||
The return value is NULL if CATEGORY is invalid.
|
||||
This call is guaranteed to be multithread-safe only if
|
||||
This call is guaranteed to be thread-safe only if
|
||||
- CATEGORY != LC_ALL and SETLOCALE_NULL_ONE_MTSAFE is true, or
|
||||
- CATEGORY == LC_ALL and SETLOCALE_NULL_ALL_MTSAFE is true,
|
||||
and the other threads must not make other setlocale invocations (since
|
||||
@@ -74,7 +74,7 @@ extern const char *setlocale_null_unlocked (int category);
|
||||
|
||||
/* setlocale_null_r (CATEGORY, BUF, BUFSIZE) is like setlocale (CATEGORY, NULL),
|
||||
except that
|
||||
- it is guaranteed to be multithread-safe,
|
||||
- it is guaranteed to be thread-safe,
|
||||
- it returns the resulting locale category name or locale name in the
|
||||
user-supplied buffer BUF, which must be BUFSIZE bytes long.
|
||||
The recommended minimum buffer size is
|
||||
@@ -84,7 +84,7 @@ extern const char *setlocale_null_unlocked (int category);
|
||||
CATEGORY is invalid, or ERANGE if BUFSIZE is smaller than the length needed
|
||||
size (including the trailing NUL byte). In the latter case, a truncated
|
||||
result is returned in BUF, but still NUL-terminated if BUFSIZE > 0.
|
||||
For this call to be multithread-safe, *all* calls to
|
||||
For this call to be thread-safe, *all* calls to
|
||||
setlocale (CATEGORY, NULL) in all other threads must have been converted
|
||||
to use setlocale_null_r or setlocale_null as well, and the other threads
|
||||
must not make other setlocale invocations (since changing the global locale
|
||||
@@ -93,9 +93,9 @@ extern int setlocale_null_r (int category, char *buf, size_t bufsize)
|
||||
_GL_ARG_NONNULL ((2));
|
||||
|
||||
/* setlocale_null (CATEGORY) is like setlocale (CATEGORY, NULL), except that
|
||||
it is guaranteed to be multithread-safe.
|
||||
it is guaranteed to be thread-safe.
|
||||
The return value is NULL if CATEGORY is invalid.
|
||||
For this call to be multithread-safe, *all* calls to
|
||||
For this call to be thread-safe, *all* calls to
|
||||
setlocale (CATEGORY, NULL) in all other threads must have been converted
|
||||
to use setlocale_null_r or setlocale_null as well, and the other threads
|
||||
must not make other setlocale invocations (since changing the global locale
|
||||
|
||||
@@ -57,8 +57,9 @@ extern "C" {
|
||||
|
||||
/* Install a SIGPIPE handler that invokes PREPARE_DIE and then emits an
|
||||
error message and exits. PREPARE_DIE may be NULL, meaning a no-op.
|
||||
In a multithreaded program, this function must be called in the main thread,
|
||||
before any other thread gets created. */
|
||||
This function should be called only in single-threaded processes.
|
||||
In a multithreaded process, this function is typically called early
|
||||
in the main thread while the process is still single-threaded. */
|
||||
extern void install_sigpipe_die_handler (void (*prepare_die) (void));
|
||||
|
||||
|
||||
|
||||
@@ -364,8 +364,8 @@ pthread_sigmask (int operation, const sigset_t *set, sigset_t *old_set)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* sigprocmask is like pthread_sigmask, except that it has undefined behaviour
|
||||
in multithreaded applications and a different return value convention. */
|
||||
/* sigprocmask is like pthread_sigmask, but has unspecified behaviour
|
||||
in multithreaded processes and a different return value convention. */
|
||||
int
|
||||
sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list,
|
||||
gl_close_fn primary,
|
||||
int fd)
|
||||
{
|
||||
/* Note about multithread-safety: There is a race condition where, between
|
||||
/* Note about thread safety: There is a race condition where, between
|
||||
our calls to closesocket() and the primary close(), some other thread
|
||||
could make system calls that allocate precisely the same HANDLE value
|
||||
as sock; then the primary close() would call CloseHandle() on it. */
|
||||
|
||||
@@ -480,7 +480,7 @@ vma_iterate_bsd (struct callback_locals *locals)
|
||||
size_t len = 0;
|
||||
if (sysctl (info_path, 4, NULL, &len, NULL, 0) < 0)
|
||||
return -1;
|
||||
/* Allow for small variations over time. In a multithreaded program
|
||||
/* Allow for small variations over time. In a multithreaded process
|
||||
new VMAs can be allocated at any moment. */
|
||||
len = 2 * len + 200;
|
||||
/* Allocate memneed bytes of memory.
|
||||
|
||||
@@ -55,7 +55,7 @@ strerror (int n)
|
||||
buffer, so all other clients of strerror have to see the error
|
||||
copied into a buffer that we manage. This is not thread-safe,
|
||||
even if the system strerror is, but portable programs shouldn't
|
||||
be using strerror if they care about thread-safety. */
|
||||
be using strerror if they care about thread safety. */
|
||||
if (!msg || !*msg)
|
||||
{
|
||||
static char const fmt[] = "Unknown error %d";
|
||||
|
||||
@@ -131,7 +131,7 @@ uniconv_register_autodetect (const char *name,
|
||||
new_alias->name = new_name;
|
||||
new_alias->encodings_to_try = new_try_in_order;
|
||||
new_alias->next = NULL;
|
||||
/* FIXME: Not multithread-safe. */
|
||||
/* FIXME: Not thread-safe. */
|
||||
*autodetect_list_end = new_alias;
|
||||
autodetect_list_end = &new_alias->next;
|
||||
return 0;
|
||||
|
||||
@@ -1041,7 +1041,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
|
||||
If *STRINGP was already NULL, nothing happens.
|
||||
Return the old value of *STRINGP.
|
||||
|
||||
This is a variant of strtok() that is multithread-safe and supports
|
||||
This is a variant of strtok() that is thread-safe and supports
|
||||
empty fields.
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
@@ -1179,7 +1179,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
|
||||
x = strtok_r(NULL, "=", &sp); // x = NULL
|
||||
// s = "abc\0-def\0"
|
||||
|
||||
This is a variant of strtok() that is multithread-safe.
|
||||
This is a variant of strtok() that is thread-safe.
|
||||
|
||||
For the POSIX documentation for this function, see:
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
|
||||
@@ -1655,7 +1655,7 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
|
||||
"use gnulib module strerror to guarantee non-NULL result");
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. Multithread-safe.
|
||||
/* Map any int, typically from errno, into an error message. Thread-safe.
|
||||
Uses the POSIX declaration, not the glibc declaration. */
|
||||
#if @GNULIB_STRERROR_R@
|
||||
# if @REPLACE_STRERROR_R@
|
||||
@@ -1711,7 +1711,7 @@ _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. Multithread-safe,
|
||||
/* Map any int, typically from errno, into an error message. Thread-safe,
|
||||
with locale_t argument.
|
||||
Not portable! Only provided by gnulib. */
|
||||
#if @GNULIB_STRERROR_L@
|
||||
|
||||
@@ -125,10 +125,10 @@ static char
|
||||
decimal_point_char (void)
|
||||
{
|
||||
const char *point;
|
||||
/* Determine it in a multithread-safe way. We know nl_langinfo is
|
||||
multithread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
|
||||
localeconv() is rarely multithread-safe. */
|
||||
/* Determine it in a thread-safe way. We know nl_langinfo is
|
||||
thread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be thread-safe by POSIX. sprintf(), however, is thread-safe.
|
||||
localeconv() is rarely thread-safe. */
|
||||
#if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
|
||||
point = nl_langinfo (RADIXCHAR);
|
||||
#elif 1
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#ifndef _THREAD_OPTIM_H
|
||||
#define _THREAD_OPTIM_H
|
||||
|
||||
/* This file defines a way to optimize multithreaded code for the single-thread
|
||||
case, based on the variable '__libc_single_threaded', defined in
|
||||
glibc >= 2.32. */
|
||||
/* This file defines a way to optimize multithreaded code for the
|
||||
single-threaded case, based on the variable '__libc_single_threaded',
|
||||
defined in glibc >= 2.32. */
|
||||
|
||||
/* Typical use: In a block or function, use
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
if (mt)
|
||||
if (pthread_mutex_unlock (&lock)) abort ();
|
||||
|
||||
The gl_multithreaded () invocation determines whether the program currently
|
||||
is multithreaded.
|
||||
gl_multithreaded () returns true if the process might be multithreaded,
|
||||
and false if the process is definitely single-threaded.
|
||||
|
||||
if (mt) STATEMENT executes STATEMENT in the multithreaded case, and skips
|
||||
it in the single-threaded case.
|
||||
if (mt) STATEMENT executes STATEMENT in the possibly-multithreaded case,
|
||||
and skips it in the single-threaded case.
|
||||
|
||||
The code between the gl_multithreaded () invocation and any use of the
|
||||
variable 'mt' must not create threads or invoke functions that may
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <time.h>
|
||||
|
||||
/* The replacement functions in this file are only used on native Windows.
|
||||
They are multithread-safe, because the gmtime() and localtime() functions
|
||||
They are thread-safe, because the gmtime() and localtime() functions
|
||||
on native Windows — both in the ucrt and in the older MSVCRT — return a
|
||||
pointer to a 'struct tm' in thread-local memory. */
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
/* Although this module is not thread-safe, any races should be fairly
|
||||
rare and reasonably benign. For complete thread-safety, use a C
|
||||
rare and reasonably benign. For complete thread safety, use a C
|
||||
library with a working timezone_t type, so that this module is not
|
||||
needed. */
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ ttyname_r (int fd, char *buf, size_t buflen)
|
||||
}
|
||||
#elif HAVE_TTYNAME_R
|
||||
/* When ttyname_r exists, use it. */
|
||||
/* This code is multithread-safe. */
|
||||
/* This code is thread-safe. */
|
||||
/* On Solaris, ttyname_r always fails if buflen < 128.
|
||||
So provide a buffer that is large enough. */
|
||||
char largerbuf[512];
|
||||
@@ -94,7 +94,7 @@ ttyname_r (int fd, char *buf, size_t buflen)
|
||||
# endif
|
||||
return 0;
|
||||
#elif HAVE_TTYNAME
|
||||
/* Note: This is not multithread-safe. */
|
||||
/* Note: This is not thread-safe. */
|
||||
char *name = ttyname (fd);
|
||||
if (name == NULL)
|
||||
return errno;
|
||||
|
||||
@@ -58,7 +58,7 @@ rpl_tzset (void)
|
||||
const char *tz = getenv ("TZ");
|
||||
if (tz != NULL && strchr (tz, '/') != NULL)
|
||||
{
|
||||
/* Neutralize it, in a way that is multithread-safe.
|
||||
/* Neutralize it, in a way that is thread-safe.
|
||||
(If we were to use _putenv ("TZ="), it would free the memory allocated
|
||||
for the environment variable "TZ", and thus other threads that are
|
||||
using the previously fetched value of getenv ("TZ") could crash.) */
|
||||
|
||||
@@ -402,10 +402,10 @@ static char
|
||||
decimal_point_char (void)
|
||||
{
|
||||
const char *point;
|
||||
/* Determine it in a multithread-safe way. We know nl_langinfo is
|
||||
multithread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
|
||||
localeconv() is rarely multithread-safe. */
|
||||
/* Determine it in a thread-safe way. We know nl_langinfo is
|
||||
thread-safe on glibc systems and Mac OS X systems, but is not required
|
||||
to be thread-safe by POSIX. sprintf(), however, is thread-safe.
|
||||
localeconv() is rarely thread-safe. */
|
||||
# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
|
||||
point = nl_langinfo (RADIXCHAR);
|
||||
# elif 1
|
||||
@@ -432,13 +432,13 @@ decimal_point_char (void)
|
||||
static const char *
|
||||
thousands_separator_char (char stackbuf[10])
|
||||
{
|
||||
/* Determine it in a multithread-safe way.
|
||||
We know nl_langinfo is multithread-safe on glibc systems, on Mac OS X
|
||||
systems, and on NetBSD, but is not required to be multithread-safe by
|
||||
/* Determine it in a thread-safe way.
|
||||
We know nl_langinfo is thread-safe on glibc systems, on Mac OS X
|
||||
systems, and on NetBSD, but is not required to be thread-safe by
|
||||
POSIX.
|
||||
localeconv() is not guaranteed to be multithread-safe by POSIX either;
|
||||
localeconv() is not guaranteed to be thread-safe by POSIX either;
|
||||
however, on native Windows it is (cf. test-localeconv-mt).
|
||||
sprintf(), however, is multithread-safe. */
|
||||
sprintf(), however, is thread-safe. */
|
||||
# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__)
|
||||
return nl_langinfo (THOUSEP);
|
||||
# elif defined _WIN32 && !defined __CYGWIN__
|
||||
@@ -466,7 +466,7 @@ thousands_separator_char (char stackbuf[10])
|
||||
static const DCHAR_T *
|
||||
thousands_separator_DCHAR (DCHAR_T stackbuf[10])
|
||||
{
|
||||
/* Determine it in a multithread-safe way. */
|
||||
/* Determine it in a thread-safe way. */
|
||||
char tmpbuf[10];
|
||||
const char *tmp = thousands_separator_char (tmpbuf);
|
||||
if (*tmp != '\0')
|
||||
@@ -589,9 +589,9 @@ thousands_separator_wchar (wchar_t stackbuf[10])
|
||||
static const signed char *
|
||||
grouping_rule (void)
|
||||
{
|
||||
/* We know nl_langinfo is multithread-safe on glibc systems and on Cygwin,
|
||||
but is not required to be multithread-safe by POSIX.
|
||||
localeconv() is not guaranteed to be multithread-safe by POSIX either;
|
||||
/* We know nl_langinfo is thread-safe on glibc systems and on Cygwin,
|
||||
but is not required to be thread-safe by POSIX.
|
||||
localeconv() is not guaranteed to be thread-safe by POSIX either;
|
||||
however, on all known systems it is (cf. test-localeconv-mt). */
|
||||
# if __GLIBC__ >= 2
|
||||
return (const signed char *) nl_langinfo (GROUPING);
|
||||
|
||||
@@ -614,7 +614,7 @@ vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
|
||||
size_t len = 0;
|
||||
if (sysctl (info_path, 4, NULL, &len, NULL, 0) < 0)
|
||||
return -1;
|
||||
/* Allow for small variations over time. In a multithreaded program
|
||||
/* Allow for small variations over time. In a multithreaded process
|
||||
new VMAs can be allocated at any moment. */
|
||||
len = 2 * len + 200;
|
||||
/* Allocate memneed bytes of memory.
|
||||
@@ -690,7 +690,7 @@ vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
|
||||
size_t len = 0;
|
||||
if (sysctl (info_path, 5, NULL, &len, NULL, 0) < 0)
|
||||
return -1;
|
||||
/* Allow for small variations over time. In a multithreaded program
|
||||
/* Allow for small variations over time. In a multithreaded process
|
||||
new VMAs can be allocated at any moment. */
|
||||
len = 2 * len + 10 * entry_size;
|
||||
/* But the system call rejects lengths > 1 MB. */
|
||||
@@ -769,7 +769,7 @@ vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
|
||||
size_t len = 0;
|
||||
if (sysctl (info_path, 3, NULL, &len, NULL, 0) < 0)
|
||||
return -1;
|
||||
/* Allow for small variations over time. In a multithreaded program
|
||||
/* Allow for small variations over time. In a multithreaded process
|
||||
new VMAs can be allocated at any moment. */
|
||||
len = 2 * len + 10 * sizeof (struct kinfo_vmentry);
|
||||
/* But the system call rejects lengths > 64 KB. */
|
||||
|
||||
@@ -65,7 +65,7 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||
#else /* HP-UX 11.00, mingw */
|
||||
/* Fallback for platforms that don't have wcrtomb().
|
||||
Implement on top of wctomb().
|
||||
This code is not multithread-safe. */
|
||||
This code is not thread-safe. */
|
||||
int ret = wctomb (s, wc);
|
||||
|
||||
if (ret >= 0)
|
||||
|
||||
@@ -54,7 +54,7 @@ rpl_wcsftime (wchar_t *buf, size_t bufsize, const wchar_t *format, const struct
|
||||
const char *tz = getenv ("TZ");
|
||||
if (tz != NULL && strchr (tz, '/') != NULL)
|
||||
{
|
||||
/* Neutralize it, in a way that is multithread-safe.
|
||||
/* Neutralize it, in a way that is thread-safe.
|
||||
(If we were to use _putenv ("TZ="), it would free the memory allocated
|
||||
for the environment variable "TZ", and thus other threads that are
|
||||
using the previously fetched value of getenv ("TZ") could crash.) */
|
||||
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
MESSAGE and the (internationalized) description of the error code ERRNUM.
|
||||
Upon [ENOMEM] memory allocation error, call xalloc_die.
|
||||
|
||||
This function is multithread-safe. */
|
||||
This function is thread-safe. */
|
||||
extern char *xstrerror (const char *message, int errnum)
|
||||
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
|
||||
_GL_ATTRIBUTE_RETURNS_NONNULL;
|
||||
|
||||
@@ -892,7 +892,7 @@ AC_DEFUN([gl_COMMON_BODY], [
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following attributes enable detection of multithread-safety problems
|
||||
/* The following attributes enable detection of thread safety problems
|
||||
and resource leaks at compile-time, by clang ≥ 15, when the warning option
|
||||
-Wthread-safety is enabled. For usage, see
|
||||
<https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
|
||||
|
||||
@@ -17,13 +17,13 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
|
||||
AC_CHECK_HEADERS_ONCE([threads.h])
|
||||
if test $ac_cv_func_nl_langinfo = yes; then
|
||||
# On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not
|
||||
# multithread-safe.
|
||||
# thread-safe.
|
||||
case "$host_os" in
|
||||
darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;;
|
||||
*) NL_LANGINFO_MTSAFE=1 ;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
|
||||
[Define to 1 if nl_langinfo is multithread-safe.])
|
||||
[Define to 1 if nl_langinfo is thread-safe.])
|
||||
if test $HAVE_LANGINFO_CODESET = 1 \
|
||||
&& test $HAVE_LANGINFO_ALTMON = 1 \
|
||||
&& test $HAVE_LANGINFO_ABALTMON = 1 \
|
||||
|
||||
@@ -103,14 +103,14 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
|
||||
])
|
||||
fi
|
||||
|
||||
dnl We want to be able to use pthread_sigmask as a multithread-safe
|
||||
dnl We want to be able to use pthread_sigmask as a thread-safe
|
||||
dnl replacement of sigprocmask, in both single-threaded and multithreaded
|
||||
dnl programs. Therefore enforce PTHREAD_SIGMASK_LIB to be empty, whenever
|
||||
dnl processes. Therefore enforce PTHREAD_SIGMASK_LIB to be empty, whenever
|
||||
dnl possible.
|
||||
if test -n "$PTHREAD_SIGMASK_LIB"; then
|
||||
dnl We get here on glibc ≤ 2.31, NetBSD, OpenBSD ≤ 5.8, AIX.
|
||||
dnl Except on AIX, pthread_sigmask and sigprocmask are equivalent.
|
||||
dnl Whereas on AIX, sigprocmask is not allowed in multithreaded programs
|
||||
dnl Whereas on AIX, sigprocmask is not allowed in multithreaded processes
|
||||
dnl <https://www.ibm.com/docs/en/aix/7.2.0?topic=s-sigprocmask-sigsetmask-sigblock-subroutine>.
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
case "$host_os" in
|
||||
|
||||
@@ -46,7 +46,7 @@ AC_DEFUN([gl_FUNC_RANDOM],
|
||||
future*) REPLACE_SETSTATE=1 ;;
|
||||
esac
|
||||
fi
|
||||
dnl On several platforms, random() is not multithread-safe.
|
||||
dnl On several platforms, random() is not thread-safe.
|
||||
if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no \
|
||||
|| case "$host_os" in \
|
||||
darwin* | freebsd* | solaris* | cygwin* | haiku*) true ;; \
|
||||
|
||||
@@ -32,13 +32,13 @@ AC_DEFUN([gl_FUNC_SETLOCALE],
|
||||
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED],
|
||||
[Define to 1 to enable general improvements of setlocale.])
|
||||
|
||||
dnl Test whether we need a multithread-safe setlocale(category,NULL).
|
||||
dnl Test whether we need a thread-safe setlocale(category,NULL).
|
||||
NEED_SETLOCALE_MTSAFE=0
|
||||
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
|
||||
NEED_SETLOCALE_MTSAFE=1
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE],
|
||||
[Define to 1 to enable a multithread-safety fix of setlocale.])
|
||||
[Define to 1 to enable a thread safety fix of setlocale.])
|
||||
|
||||
if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then
|
||||
REPLACE_SETLOCALE=1
|
||||
|
||||
@@ -12,7 +12,7 @@ AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
|
||||
AC_REQUIRE([gl_PTHREADLIB])
|
||||
AC_CHECK_HEADERS_ONCE([threads.h])
|
||||
|
||||
AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe],
|
||||
AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is thread-safe],
|
||||
[gl_cv_func_setlocale_null_all_mtsafe],
|
||||
[case "$host_os" in
|
||||
# Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku.
|
||||
@@ -54,10 +54,10 @@ AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
|
||||
*) SETLOCALE_NULL_ALL_MTSAFE=0 ;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE],
|
||||
[Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.])
|
||||
[Define to 1 if setlocale (LC_ALL, NULL) is thread-safe.])
|
||||
|
||||
dnl This is about a single category (not LC_ALL).
|
||||
AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe],
|
||||
AC_CACHE_CHECK([whether setlocale (category, NULL) is thread-safe],
|
||||
[gl_cv_func_setlocale_null_one_mtsafe],
|
||||
[case "$host_os" in
|
||||
# Guess no on OpenBSD, AIX.
|
||||
@@ -85,7 +85,7 @@ AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
|
||||
*) SETLOCALE_NULL_ONE_MTSAFE=0 ;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE],
|
||||
[Define to 1 if setlocale (category, NULL) is multithread-safe.])
|
||||
[Define to 1 if setlocale (category, NULL) is thread-safe.])
|
||||
|
||||
dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c.
|
||||
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
|
||||
|
||||
@@ -161,13 +161,13 @@ dnl -------------
|
||||
dnl Tests for the libraries needs for using the POSIX threads API.
|
||||
dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile.
|
||||
dnl Sets the variable LIBPMULTITHREAD, for programs that really need
|
||||
dnl multithread functionality. The difference between LIBPTHREAD and
|
||||
dnl multithreading. The difference between LIBPTHREAD and
|
||||
dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically
|
||||
dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not.
|
||||
dnl Sets the variable SCHED_YIELD_LIB to the linker options needed to use the
|
||||
dnl sched_yield() function.
|
||||
dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
|
||||
dnl multithread-safe programs.
|
||||
dnl thread-safe programs.
|
||||
dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX
|
||||
dnl threads API is available.
|
||||
|
||||
@@ -321,7 +321,7 @@ dnl ---------------
|
||||
dnl Tests for the libraries needs for using the ISO C threads API.
|
||||
dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile.
|
||||
dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
|
||||
dnl multithread-safe programs.
|
||||
dnl thread-safe programs.
|
||||
dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads
|
||||
dnl API is available.
|
||||
|
||||
@@ -400,11 +400,11 @@ dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
|
||||
dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
|
||||
dnl libtool).
|
||||
dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
|
||||
dnl programs that really need multithread functionality. The difference
|
||||
dnl programs that really need multithreading. The difference
|
||||
dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
|
||||
dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not.
|
||||
dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
|
||||
dnl multithread-safe programs.
|
||||
dnl thread-safe programs.
|
||||
dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the
|
||||
dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the
|
||||
dnl same value. Only system libraries are needed.
|
||||
@@ -436,12 +436,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
|
||||
m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
|
||||
dnl Don't display the --disable-threads option
|
||||
dnl - if the package builds one or more libraries, because libraries must
|
||||
dnl always be multithread-safe (as far as possible),
|
||||
dnl always be thread-safe (as far as possible),
|
||||
dnl - if the package defines gl_THREADLIB_DEFAULT_NO, because the option
|
||||
dnl would then be a no-op.
|
||||
AC_ARG_ENABLE([threads],
|
||||
AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([LT_INIT], [], [m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
|
||||
AS_HELP_STRING([[--disable-threads]], [build without multithread safety])])]),
|
||||
AS_HELP_STRING([[--disable-threads]], [build without thread safety])])]),
|
||||
[gl_use_threads=$enableval],
|
||||
[if test -n "$gl_use_threads_default"; then
|
||||
gl_use_threads="$gl_use_threads_default"
|
||||
@@ -485,7 +485,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
|
||||
LTLIBMULTITHREAD=
|
||||
AS_IF([test "$gl_use_threads" = no],
|
||||
[AC_DEFINE([AVOID_ANY_THREADS], [1],
|
||||
[Define if no multithread safety and no multithreading is desired.])],
|
||||
[Define if neither thread safety nor multithreading is desired.])],
|
||||
[
|
||||
dnl Check whether the compiler and linker support weak declarations.
|
||||
gl_WEAK_SYMBOLS
|
||||
@@ -572,7 +572,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
|
||||
])
|
||||
])
|
||||
])
|
||||
AC_MSG_CHECKING([for multithread API to use])
|
||||
AC_MSG_CHECKING([for multithreading API to use])
|
||||
AC_MSG_RESULT([$gl_threads_api])
|
||||
AC_SUBST([LIBTHREAD])
|
||||
AC_SUBST([LTLIBTHREAD])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Description:
|
||||
getumask() function: retrieve the umask of the process (multithread-safe)
|
||||
getumask() function: retrieve the umask of the process (thread-safe)
|
||||
|
||||
Files:
|
||||
lib/getumask.c
|
||||
|
||||
@@ -2,7 +2,7 @@ Description:
|
||||
A simplified variant of GNU libsigsegv.
|
||||
It implements the most important features of GNU libsigsegv: catching SIGSEGV
|
||||
and catching stack overflow. It does *not* implement the 'sigsegv_dispatcher'
|
||||
type (which is not multithread-safe).
|
||||
type (which is not thread-safe).
|
||||
It supports all modern Unix-like platforms: Linux, Hurd, FreeBSD, NetBSD,
|
||||
OpenBSD, macOS, AIX, Solaris, Cygwin, Haiku. It does *not* support HP-UX, Minix,
|
||||
native Windows; on these platforms the module compiles and provides a
|
||||
|
||||
@@ -12,10 +12,8 @@ AC_DEFINE([GNULIB_STDIO_SINGLE_THREAD], [1],
|
||||
[Define to 1 if you want the FILE stream functions getc, putc, etc.
|
||||
to use unlocked I/O if available, throughout the package.
|
||||
Unlocked I/O can improve performance, sometimes dramatically.
|
||||
But unlocked I/O is safe only in single-threaded programs,
|
||||
as well as in multithreaded programs for which you can guarantee that
|
||||
every FILE stream, including stdin, stdout, stderr, is used only
|
||||
in a single thread.])
|
||||
But unlocked I/O is safe only in processes in which two threads
|
||||
never simultaneously access the same FILE stream.])
|
||||
|
||||
AC_DEFINE([USE_UNLOCKED_IO], [GNULIB_STDIO_SINGLE_THREAD],
|
||||
[An alias of GNULIB_STDIO_SINGLE_THREAD.])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Description:
|
||||
xstrerror() function: return diagnostic string based on error code.
|
||||
Multithread-safe. With out-of-memory checking.
|
||||
thread-safe. With out-of-memory checking.
|
||||
|
||||
Files:
|
||||
lib/xstrerror.h
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for c_strtod().
|
||||
/* Thread safety test for c_strtod().
|
||||
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for c_strtof().
|
||||
/* Thread safety test for c_strtof().
|
||||
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for c_strtold().
|
||||
/* Thread safety test for c_strtold().
|
||||
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for gmtime_r().
|
||||
/* Thread safety test for gmtime_r().
|
||||
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for localeconv()
|
||||
/* Thread safety test for localeconv()
|
||||
(in the absence of setlocale() or uselocale() calls).
|
||||
Copyright (C) 2019-2026 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Multithread-safety test for localtime_r().
|
||||
/* Thread safety test for localtime_r().
|
||||
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user