]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: Destroy thread-specific data before releasing joins
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 14 Feb 2022 00:39:35 +0000 (01:39 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 14 Feb 2022 18:29:02 +0000 (19:29 +0100)
Applications may want to assume that after pthread_join() returns, all
thread-specific data has been released.

htl/pt-exit.c

index db1c14c52044824c27a906830f3fa3aa940b4c74..f0759c8738e6da4c8e0ba47f6d15720203f6954e 100644 (file)
@@ -54,6 +54,9 @@ __pthread_exit (void *status)
     /* We are the last thread.  */
     exit (0);
 
+  /* Destroy any thread specific data.  */
+  __pthread_destroy_specific (self);
+
   /* Note that after this point the process can be terminated at any
      point if another thread calls `pthread_exit' and happens to be
      the last thread.  */
@@ -92,9 +95,6 @@ __pthread_exit (void *status)
       break;
     }
 
-  /* Destroy any thread specific data.  */
-  __pthread_destroy_specific (self);
-
   /* Destroy any signal state.  */
   __pthread_sigstate_destroy (self);