]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: Fix mt-safeness of libio
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 1 Mar 2026 16:57:54 +0000 (17:57 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 1 Mar 2026 16:57:54 +0000 (17:57 +0100)
Since d2e04918833 ("Single threaded stdio optimization")
we are supposed to call _IO_enable_locks when creating the first thread,
but that commit missed doing it for htl.

htl/pt-create.c

index ef9e411f228cceb4648f24763c461dc9c7313026..2a432853722a0e41f6cd6dbffaac265b37ca618e 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/single_threaded.h>
 #include <shlib-compat.h>
 #include <ldsodefs.h>
+#include <libioP.h>
 
 #include <pt-internal.h>
 #include <pthreadP.h>
@@ -250,6 +251,9 @@ __pthread_create_internal (struct __pthread **thread,
      avoid calling pthread_self), read it before starting the thread.  */
   *thread = pthread;
 
+  if (start_routine)
+    _IO_enable_locks ();
+
   /* Schedule the new thread.  */
   err = __pthread_thread_start (pthread);
   if (err)