1
0
mirror of https://sourceware.org/git/glibc.git synced 2026-01-06 11:51:29 +03:00

linux: Use __libc_single_threaded on fork

Checked on x86_64-linux-gnu.
This commit is contained in:
Adhemerval Zanella
2021-01-18 15:32:02 -03:00
parent 2b47727c68
commit 2883de0720

View File

@@ -34,6 +34,7 @@
#include <malloc/malloc-internal.h>
#include <nss/nss_database.h>
#include <unwind-link.h>
#include <sys/single_threaded.h>
static void
fresetlockfiles (void)
@@ -55,7 +56,7 @@ __libc_fork (void)
handlers in the single-thread case, to make fork safer to use in
signal handlers. POSIX requires that fork is async-signal-safe,
but our current fork implementation is not. */
bool multiple_threads = THREAD_GETMEM (THREAD_SELF, header.multiple_threads);
bool multiple_threads = __libc_single_threaded == 0;
__run_fork_handlers (atfork_run_prepare, multiple_threads);