-
-/* When we catch an internal error, should we pass it back to Lisp to
- * be handled in a high-level way? (Early in cold init, the answer is
- * 'no', because Lisp is still too brain-dead to handle anything.
- * After sufficient initialization has been completed, the answer
- * becomes 'yes'.) */
-boolean internal_errors_enabled = 0;
-
-#ifndef LISP_FEATURE_WIN32
-static
-void (*interrupt_low_level_handlers[NSIG]) (int, siginfo_t*, os_context_t*);
-#endif
-union interrupt_handler interrupt_handlers[NSIG];
-
-void
-block_blockable_signals(void)
-{
-#ifndef LISP_FEATURE_WIN32
- thread_sigmask(SIG_BLOCK, &blockable_sigset, 0);
-#endif
-}
-
-void
-block_deferrable_signals(void)
-{
-#ifndef LISP_FEATURE_WIN32
- thread_sigmask(SIG_BLOCK, &deferrable_sigset, 0);
-#endif
-}
-
-void
-unblock_deferrable_signals_in_sigset(sigset_t *sigset)
-{
-#ifndef LISP_FEATURE_WIN32
- if (interrupt_handler_pending_p())
- lose("unblock_deferrable_signals_in_sigset: losing proposition\n");
- check_gc_signals_unblocked_in_sigset_or_lose(sigset);
- sigdelset_deferrable(sigset);
-#endif
-}
-
-void
-unblock_deferrable_signals(void)
-{
-#ifndef LISP_FEATURE_WIN32
- if (interrupt_handler_pending_p())
- lose("unblock_deferrable_signals: losing proposition\n");
- check_gc_signals_unblocked_or_lose();
- thread_sigmask(SIG_UNBLOCK, &deferrable_sigset, 0);
-#endif
-}
-
-void
-unblock_gc_signals(void)
-{
-#if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_WIN32)
- thread_sigmask(SIG_UNBLOCK,&gc_sigset,0);
-#endif
-}
-
-void
-unblock_signals_in_context_and_maybe_warn(os_context_t *context)
-{
-#ifndef LISP_FEATURE_WIN32
- int i, oops=0;
- sigset_t *sigset=os_context_sigmask_addr(context);
- for(i = 1; i < NSIG; i++) {
- if (sigismember(&gc_sigset, i) && sigismember(sigset, i)) {
- if (!oops) {
- fprintf(stderr,
-"Enabling blocked gc signals to allow returning to Lisp without risking\n\
-gc deadlocks. Since GC signals are only blocked in signal handlers when \n\
-they are not safe to interrupt at all, this is a pretty severe occurrence.\n");
- }
- oops=1;
- }
- }
- sigdelset_gc(sigset);
- if (!interrupt_handler_pending_p()) {
- unblock_deferrable_signals_in_sigset(sigset);
- }
-#endif
-}
-