From: Chris Hanson Date: Fri, 5 Jul 1991 23:30:46 +0000 (+0000) Subject: Eliminate use of CATCH and THROW macros. Use position in `struct X-Git-Tag: 20090517-FFI~10483 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d05b6ca8eb9fefff8dfcd47191eeb2de15eb3e4f;p=mit-scheme.git Eliminate use of CATCH and THROW macros. Use position in `struct interruptable_extent' to set the dstack after a throw. Guarantee that signal mask is restored last when interrupting. --- diff --git a/v7/src/microcode/intext.c b/v7/src/microcode/intext.c index e4fc9c11f..a045c2390 100644 --- a/v7/src/microcode/intext.c +++ b/v7/src/microcode/intext.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.c,v 1.2 1991/06/22 19:29:02 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.c,v 1.3 1991/07/05 23:30:46 cph Exp $ Copyright (c) 1990-91 Massachusetts Institute of Technology @@ -56,14 +56,19 @@ struct interruptable_extent * DEFUN_VOID (enter_interruptable_extent) { PTR position = dstack_position; - struct interruptable_extent * frame = - (dstack_alloc (sizeof (struct interruptable_extent))); + struct interruptable_extent * frame; + /* Inside the interrupt handler, the signal mask will be different. + Push a winding frame that will restore it to its current value. + Do this before any other changes so that the other changes are + undone before the signal mask is restored (possibly causing + another interrupt). */ + preserve_signal_mask (); + frame = (dstack_alloc (sizeof (struct interruptable_extent))); (frame -> position) = position; (frame -> interrupted) = 0; /* Create a dynamic binding frame but don't assign the new frame to - it until the CATCH has been done. */ + it until the setjmp has been done. */ dstack_bind ((¤t_interruptable_extent), current_interruptable_extent); - preserve_signal_mask (); return (frame); } @@ -87,5 +92,5 @@ DEFUN_VOID (enter_interruption_extent) void DEFUN_VOID (exit_interruption_extent) { - THROW ((current_interruptable_extent -> control_point), 1); + longjmp ((current_interruptable_extent -> control_point), 1); } diff --git a/v7/src/microcode/intext.h b/v7/src/microcode/intext.h index cb1284bed..383abec6a 100644 --- a/v7/src/microcode/intext.h +++ b/v7/src/microcode/intext.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.h,v 1.1 1990/06/20 19:35:53 cph Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.h,v 1.2 1991/07/05 23:30:34 cph Exp $ -Copyright (c) 1990 Massachusetts Institute of Technology +Copyright (c) 1990-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -41,7 +41,7 @@ MIT in each case. */ struct interruptable_extent { PTR position; - Tcatch_tag control_point; + jmp_buf control_point; int interrupted; }; @@ -57,7 +57,7 @@ extern void EXFUN (exit_interruption_extent, (void)); { \ struct interruptable_extent * INTERRUPTABLE_EXTENT_frame = \ (enter_interruptable_extent ()); \ - if ((CATCH (INTERRUPTABLE_EXTENT_frame -> control_point)) == 0) \ + if ((setjmp (INTERRUPTABLE_EXTENT_frame -> control_point)) == 0) \ { \ current_interruptable_extent = INTERRUPTABLE_EXTENT_frame; \ (result) = (expression); \