1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00
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().
This commit is contained in:
Ulrich Drepper
2001-11-28 22:27:20 +00:00
parent 4e735c9aaf
commit cf6a2367e8
3 changed files with 18 additions and 1 deletions

View 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);
}