summaryrefslogtreecommitdiff
path: root/devel/linuxthreads
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>2002-09-06 14:57:50 +0000
committerTor Egge <tegge@FreeBSD.org>2002-09-06 14:57:50 +0000
commitd573a7ff4edd7e6965b33e7b6b1bca77d9117271 (patch)
tree4f32c981249b83a135f7eea286014f8666903a45 /devel/linuxthreads
parentFix packaging list. (diff)
Let main thread do an exit(1) instead of an exit(0) on unclean program
termination (multiple active threads).
Diffstat (limited to 'devel/linuxthreads')
-rw-r--r--devel/linuxthreads/files/patch-aa12
1 files changed, 8 insertions, 4 deletions
diff --git a/devel/linuxthreads/files/patch-aa b/devel/linuxthreads/files/patch-aa
index 60aad9eba75d..5d1135c31321 100644
--- a/devel/linuxthreads/files/patch-aa
+++ b/devel/linuxthreads/files/patch-aa
@@ -530,13 +530,15 @@ diff -ru ../../work/linuxthreads-2.2.3/manager.c ./manager.c
__pthread_exit_code = exitcode;
/* Send the CANCEL signal to all running threads, including the main
thread, but excluding the thread from which the exit request originated
-@@ -846,6 +875,9 @@
+@@ -846,6 +875,11 @@
for (th = issuing_thread->p_nextlive;
th != issuing_thread;
th = th->p_nextlive) {
+ /* Cancelled thread might have been in critical region unless terminated */
-+ if (th->p_terminated == 0)
++ if (th->p_terminated == 0) {
+ __pthread_exit_alone = 0;
++ __pthread_exit_code = 1;
++ }
kill(th->p_pid, __pthread_sig_cancel);
}
/* Now, wait for all these threads, so that they don't become zombies
@@ -806,7 +808,7 @@ diff -ru ../../work/linuxthreads-2.2.3/pthread.c ./pthread.c
__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request));
suspend(self);
-@@ -768,25 +759,28 @@
+@@ -768,25 +759,30 @@
if (self == __pthread_main_thread)
{
waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
@@ -827,8 +829,10 @@ diff -ru ../../work/linuxthreads-2.2.3/pthread.c ./pthread.c
+ * been inside a critical region of code with a spinlock
+ * held, a system mutex held, or a mutex partially held.
+ */
-+ if (__pthread_exit_alone == 0)
++ if (__pthread_exit_alone == 0) {
++ __pthread_exit_code = 1;
+ _exit(1);
++ }
}
}