Revised signal.c patch

From: David Fox <fox_at_remove.this.cat.nyu.edu>
Date: 04 Dec 1996 11:29:24 -0500

There's a bug in my patch to signal.c -- if one of the ignored
interrupts (SIGPROF, SIGUSR1, SIGUSR2) occurs at a critical point
the attempt to cons in the signal handler will cause a failure.
This revised patch avoids this cons if the signal handler is NIL.

diff -ru STk-3.1/Src/signal.c.orig STk-3.1/Src/signal.c
--- STk-3.1/Src/signal.c.orig Sun Jul 14 06:34:09 1996
+++ STk-3.1/Src/signal.c Wed Dec 4 11:07:28 1996
_at_@ -92,7 +92,11 @@
     }
     else STk_handle_sigint_signal();
   }
-
+
+ /* This NIL check is to make sure no consing (and hence no gc-ing) occurs
+ * while handling signals like SIGPROF that belong to the system.
+ */
+ if (signals[sig] == NIL) return;
   arg = LIST1(STk_makeinteger((long) sig));
   for (l = signals[sig]; CONSP(l); l = CDR(l)) {
     if (STk_apply(CAR(l), arg) == Sym_break) break;
_at_@ -185,6 +189,24 @@
       0) ? Ntruth : NIL;
     /* Treat specially SIGINT (^C) */
     signals[SIGINT] = NIL;
+#ifdef SIGPROF
+ if (i == SIGPROF) {
+ signals[SIGPROF] = NIL;
+ continue; /* Don't interfere with the profiler */
+ }
+#endif
+#ifdef SIGUSR1
+ if (i == SIGUSR1) {
+ signals[SIGUSR1] = NIL;
+ continue; /* Don't interfere with linuxthreads */
+ }
+#endif
+#ifdef SIGUSR1
+ if (i == SIGUSR1) {
+ signals[SIGUSR1] = NIL;
+ continue; /* Don't interfere with linuxthreads */
+ }
+#endif
 #ifdef HAVE_SIGACTION
     {
       /* Use the secure Posix.1 way */
-- 
David Fox	    http://www.cat.nyu.edu/fox		 xoF divaD
NYU Media Research Lab   fox_at_cat.nyu.edu    baL hcraeseR aideM UYN
Received on Wed Dec 04 1996 - 17:20:46 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST