]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 28 Nov 2001 22:27:20 +0000 (22:27 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 28 Nov 2001 22:27:20 +0000 (22:27 +0000)
2001-11-22  Wolfram Gloger  <wg@malloc.de>

* pthread.c (pthread_onexit_process): Don't call free
after threads have been asynchronously terminated.

* manager.c (pthread_handle_exit): Surround cancellation
of threads with __flockfilelist()/__funlockfilelist().

linuxthreads/ChangeLog
linuxthreads/manager.c
linuxthreads/pthread.c

index b6aa503b0b783fb82dcaec8544221a2519fe3e2e..307388b6f6a53538eee62157eb9ecde69b2d68fc 100644 (file)
@@ -1,3 +1,11 @@
+2001-11-22  Wolfram Gloger  <wg@malloc.de>
+
+       * pthread.c (pthread_onexit_process): Don't call free
+       after threads have been asynchronously terminated.
+
+       * manager.c (pthread_handle_exit): Surround cancellation
+       of threads with __flockfilelist()/__funlockfilelist().
+
 2001-11-26  Andreas Schwab  <schwab@suse.de>
 
        * manager.c (pthread_handle_create): Start the child thread with
index c8808197c15dd8785ef91624c912293903e616be..0872146e3f52d9ad78f8102c301b7064d744ef49 100644 (file)
@@ -909,6 +909,12 @@ static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode)
   pthread_descr th;
   __pthread_exit_requested = 1;
   __pthread_exit_code = exitcode;
+  /* A forced asynchronous cancellation follows.  Make sure we won't
+     get stuck later in the main thread with a system lock being held
+     by one of the cancelled threads.  Ideally one would use the same
+     code as in pthread_atfork(), but we can't distinguish system and
+     user handlers there.  */
+  __flockfilelist();
   /* Send the CANCEL signal to all running threads, including the main
      thread, but excluding the thread from which the exit request originated
      (that thread must complete the exit, e.g. calling atexit functions
@@ -925,6 +931,7 @@ static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode)
        th = th->p_nextlive) {
     waitpid(th->p_pid, NULL, __WCLONE);
   }
+  __fresetlockfiles();
   restart(issuing_thread);
   _exit(0);
 }
index b287dc8d0374020f0d8aa262877cf7dd7f58b28b..81261416e2620951b146cae47e91655465aa14f5 100644 (file)
@@ -795,7 +795,9 @@ static void pthread_onexit_process(int retcode, void *arg)
     if (self == __pthread_main_thread)
       {
        waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
-       free (__pthread_manager_thread_bos);
+       /* Since all threads have been asynchronously terminated
+           (possibly holding locks), free cannot be used any more.  */
+       /*free (__pthread_manager_thread_bos);*/
        __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL;
       }
   }