about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/pthread_create.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index f348a6f6dd..e05013e317 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -35,6 +35,7 @@
 #include <tls-setup.h>
 #include <rseq-internal.h>
 #include "libioP.h"
+#include <sys/single_threaded.h>
 
 #include <shlib-compat.h>
 
@@ -625,6 +626,10 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
 {
   STACK_VARIABLES;
 
+  /* Avoid a data race in the multi-threaded case.  */
+  if (__libc_single_threaded)
+    __libc_single_threaded = 0;
+
   const struct pthread_attr *iattr = (struct pthread_attr *) attr;
   union pthread_attr_transparent default_attr;
   bool destroy_default_attr = false;