From: Chris Hanson Date: Tue, 2 Jul 1991 18:16:59 +0000 (+0000) Subject: Block all signals while performing dstack allocation and deallocation. X-Git-Tag: 20090517-FFI~10495 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fccde0475a08fb7c1ad2305dead8a41794687cc0;p=mit-scheme.git Block all signals while performing dstack allocation and deallocation. --- diff --git a/v7/src/microcode/uxsig.c b/v7/src/microcode/uxsig.c index 70ca3f648..27656f44b 100644 --- a/v7/src/microcode/uxsig.c +++ b/v7/src/microcode/uxsig.c @@ -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 */ /* Signal Descriptors */ diff --git a/v7/src/microcode/wind.c b/v7/src/microcode/wind.c index 0cf72b913..f5ef116aa 100644 --- a/v7/src/microcode/wind.c +++ b/v7/src/microcode/wind.c @@ -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 #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