Eliminate use of CATCH and THROW macros. Use position in `struct
authorChris Hanson <org/chris-hanson/cph>
Fri, 5 Jul 1991 23:30:46 +0000 (23:30 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 5 Jul 1991 23:30:46 +0000 (23:30 +0000)
interruptable_extent' to set the dstack after a throw.  Guarantee that
signal mask is restored last when interrupting.

v7/src/microcode/intext.c
v7/src/microcode/intext.h

index e4fc9c11f83c495450028cd25ad23b703109801c..a045c239054f6a8f199fc5c6f66c2fe092d28c9c 100644 (file)
@@ -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 ((&current_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);
 }
index cb1284bed6793a1010360822c3e365543058eeaf..383abec6a9dca191a46b06a00ed8599640c0cb4d 100644 (file)
@@ -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);                                         \