[120] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

small signals patch for 1_60-beta3

daemon@ATHENA.MIT.EDU (William S. Gribble)
Wed Sep 13 18:32:26 1995

From: "William S. Gribble" <grib@cs.utexas.edu>
Date: Wed, 13 Sep 1995 16:54:16 -0500
To: pthreads@MIT.EDU
Cc: pthreads-bugs@MIT.EDU


I was running into a problem where a thread that had received a signal
via pthread_kill() would never call pthread_sig_process() to handle it. 
The thread's sigcount and sigpending were correct, but none of the 
four places that call pthread_sig_process were ever being reached.  
Sorry I can't give example code; it would be hard to whittle the code
down enough.  An effective patch was to add another check for 
pending signals in the sig_handler_fake(), which ensures that a thread
with a pending signal won't lose that signal if it is the only thread and
is continuously calling pthread_yield(). 

I have applied the signal handling patches from the list that were
posted a week or two ago, so your line numbers may vary. 
(the patch is to pthreads/pthreads/signal.c)

--- signal.c~	Tue Sep 12 09:33:55 1995
+++ signal.c	Wed Sep 13 16:22:06 1995
@@ -420,6 +420,12 @@
 	}
 	pthread_kernel_lock++;
 	sig_handler(sig);
+
+	/* Handle any signals the current thread might have just gotten */
+	if (pthread_run && pthread_run->sigcount) {
+		pthread_sig_process();
+	}
+
 	while (!(--pthread_kernel_lock)) {
 		if (SIG_ANY(sig_to_process)) {
 			pthread_kernel_lock++;




 

home help back first fref pref prev next nref lref last post