(pthread_handle_exit): Surround cancellation of threads with

__flockfilelist()/__funlockfilelist().
This commit is contained in:
Ulrich Drepper 2001-11-28 22:30:37 +00:00
parent a906a464fc
commit 30d4dc2b3a

View File

@ -893,6 +893,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
@ -909,6 +915,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);
}