PATCH: boehm-gc SIGINT handling (linux)
Bryce McKinlay
bryce@albatross.co.nz
Wed Dec 8 12:30:00 GMT 1999
Boehm-gc blocks all signals to threads waiting for a SIG_RESTART during
a collection. This can result in a deadlock if Ctrl-C is pressed during
a collection (some threads get left waiting for the SIG_RESTART when the
thread doing the collection has gone).
This patch allows SIGINT/SIGQUIT to be delivered at any time, fixing the
problem.
(I'm not sure if the second part of the patch is really neccessary, but
it doesn't seem to hurt...)
regards
[ bryce ]
Index: boehm-gc/linux_threads.c
===================================================================
RCS file: /cvs/java/libgcj/boehm-gc/linux_threads.c,v
retrieving revision 1.4
diff -u -r1.4 linux_threads.c
--- linux_threads.c 1999/11/01 23:15:51 1.4
+++ linux_threads.c 1999/12/08 20:18:54
@@ -173,6 +173,8 @@
/* is no race. */
if (sigfillset(&mask) != 0) ABORT("sigfillset() failed");
if (sigdelset(&mask, SIG_RESTART) != 0) ABORT("sigdelset()
failed");
+ if (sigdelset(&mask, SIGINT) != 0) ABORT("sigdelset() failed");
+ if (sigdelset(&mask, SIGQUIT) != 0) ABORT("sigdelset() failed");
do {
me->signal = 0;
sigsuspend(&mask); /* Wait for signal */
@@ -433,6 +435,15 @@
if (sigfillset(&act.sa_mask) != 0) {
ABORT("sigfillset() failed");
}
+
+ if (sigdelset(&act.sa_mask, SIGINT) != 0) {
+ ABORT("sigdelset() failed");
+ }
+
+ if (sigdelset(&act.sa_mask, SIGQUIT) != 0) {
+ ABORT("sigdelset() failed");
+ }
+
/* SIG_RESTART is unmasked by the handler when necessary. */
act.sa_handler = GC_suspend_handler;
if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
More information about the Java-patches
mailing list