summaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-28 22:30:37 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-28 22:30:37 +0000
commit30d4dc2b3a8b1233b5e1d10304c7dfdef8283bc5 (patch)
treeadfad43d1aad72390a78985e70a575eae0b4032d /linuxthreads
parenta906a464fcd430e58f292f866d94a001e9c0dbb4 (diff)
(pthread_handle_exit): Surround cancellation of threads with
__flockfilelist()/__funlockfilelist().
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/manager.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 41f53f38ef..97223eab3b 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -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);
}