Block all signals while performing dstack allocation and deallocation.
authorChris Hanson <org/chris-hanson/cph>
Tue, 2 Jul 1991 18:16:59 +0000 (18:16 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 2 Jul 1991 18:16:59 +0000 (18:16 +0000)
v7/src/microcode/uxsig.c
v7/src/microcode/wind.c

index 70ca3f64846b1d98787e524008382616edd50af1..27656f44b2f47877394c15b30eea9fbe201312b2 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxsig.c,v 1.10 1991/06/22 19:29:05 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxsig.c,v 1.11 1991/07/02 18:16:47 cph Exp $
 
 Copyright (c) 1990-91 Massachusetts Institute of Technology
 
@@ -125,6 +125,22 @@ DEFUN_VOID (preserve_signal_mask)
   dstack_protect (restore_signal_mask, outside);
 }
 
+static sigset_t blocked_signals;
+
+void
+DEFUN_VOID (block_signals)
+{
+  sigset_t all_signals;
+  UX_sigfillset (&all_signals);
+  UX_sigprocmask (SIG_BLOCK, (&all_signals), (&blocked_signals));
+}
+
+void
+DEFUN_VOID (unblock_signals)
+{
+  UX_sigprocmask (SIG_SETMASK, (&blocked_signals), 0);
+}
+
 #else /* not HAVE_POSIX_SIGNALS */
 
 void
@@ -132,6 +148,16 @@ DEFUN_VOID (preserve_signal_mask)
 {
 }
 
+void
+DEFUN_VOID (block_signals)
+{
+}
+
+void
+DEFUN_VOID (unblock_signals)
+{
+}
+
 #endif /* not HAVE_POSIX_SIGNALS */
 \f
 /* Signal Descriptors */
index 0cf72b91318bcdd50df773072441101096fd4458..f5ef116aae4f2d652601eee8908dff5a94208556 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1990 Free Software Foundation, Inc.
+/* Copyright (C) 1990-91 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/wind.c,v 1.1 1990/06/20 19:38:59 cph Rel $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/wind.c,v 1.2 1991/07/02 18:16:59 cph Exp $ */
 
 #include <stdio.h>
 #include "obstack.h"
@@ -23,6 +23,9 @@ extern void EXFUN (free, (PTR ptr));
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
+extern void EXFUN (block_signals, (void));
+extern void EXFUN (unblock_signals, (void));
+
 static void
 DEFUN (error, (procedure_name, message),
        CONST char * procedure_name AND
@@ -65,8 +68,10 @@ DEFUN_VOID (dstack_initialize)
 void
 DEFUN_VOID (dstack_reset)
 {
+  block_signals ();
   obstack_free ((&dstack), 0);
   dstack_initialize ();
+  unblock_signals ();
 }
 
 #define EXPORT(sp) ((PTR) (((char *) (sp)) + (sizeof (PTR))))
@@ -74,9 +79,12 @@ DEFUN_VOID (dstack_reset)
 PTR
 DEFUN (dstack_alloc, (length), unsigned int length)
 {
-  PTR chunk = (obstack_alloc ((&dstack), ((sizeof (PTR)) + length)));
+  PTR chunk;
+  block_signals ();
+  chunk = (obstack_alloc ((&dstack), ((sizeof (PTR)) + length)));
   (* ((PTR *) chunk)) = dstack_position;
   dstack_position = chunk;
+  unblock_signals ();
   return (EXPORT (chunk));
 }
 
@@ -96,6 +104,19 @@ DEFUN (dstack_protect, (protector, environment),
 void
 DEFUN (dstack_set_position, (position), PTR position)
 {
+  block_signals ();
+#define DEBUG_DSTACK
+#ifdef DEBUG_DSTACK
+  {
+    PTR * sp = dstack_position;
+    while (sp != position)
+      {
+       if (sp == 0)
+         error ("dstack_set_position", "position argument not found");
+       sp = (*sp);
+      }
+  }
+#endif /* DEBUG_DSTACK */
   while (dstack_position != position)
     {
       if (dstack_position == 0)
@@ -115,6 +136,7 @@ DEFUN (dstack_set_position, (position), PTR position)
        obstack_free ((&dstack), sp);
       }
     }
+  unblock_signals ();
 }
 
 struct binding_record