+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ if (!deferrables_blocked_p(sigset))
+ lose("deferrables unblocked\n");
+#endif
+}
+
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+boolean
+blockables_blocked_p(sigset_t *sigset)
+{
+ return all_signals_blocked_p(sigset, &blockable_sigset, "blockable");
+}
+#endif
+
+void
+check_blockables_unblocked_or_lose(sigset_t *sigset)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ if (blockables_blocked_p(sigset))
+ lose("blockables blocked\n");
+#endif
+}
+
+void
+check_blockables_blocked_or_lose(sigset_t *sigset)
+{
+#if !defined(LISP_FEATURE_WIN32)
+ /* On Windows, there are no actual signals, but since the win32 port
+ * tracks the sigmask and checks it explicitly, some functions are
+ * still required to keep the mask set up properly. (After all, the
+ * goal of the sigmask emulation is to not have to change all the
+ * call sites in the first place.)
+ *
+ * However, this does not hold for all signals equally: While
+ * deferrables matter ("is interrupt-thread okay?"), it is not worth
+ * having to set up blockables properly (which include the
+ * non-existing GC signals).
+ *
+ * Yet, as the original comment explains it:
+ * Adjusting FREE-INTERRUPT-CONTEXT-INDEX* and other aspecs of
+ * fake_foreign_function_call machinery are sometimes useful here[...].
+ *
+ * So we merely skip this assertion.
+ * -- DFL, trying to expand on a comment by AK.
+ */
+ if (!blockables_blocked_p(sigset))
+ lose("blockables unblocked\n");
+#endif
+}
+
+#ifndef LISP_FEATURE_SB_SAFEPOINT
+#if !defined(LISP_FEATURE_WIN32)
+boolean
+gc_signals_blocked_p(sigset_t *sigset)
+{
+ return all_signals_blocked_p(sigset, &gc_sigset, "gc");
+}
+#endif
+
+void
+check_gc_signals_unblocked_or_lose(sigset_t *sigset)
+{
+#if !defined(LISP_FEATURE_WIN32)
+ if (gc_signals_blocked_p(sigset))
+ lose("gc signals blocked\n");
+#endif
+}
+
+void
+check_gc_signals_blocked_or_lose(sigset_t *sigset)
+{
+#if !defined(LISP_FEATURE_WIN32)
+ if (!gc_signals_blocked_p(sigset))
+ lose("gc signals unblocked\n");
+#endif
+}
+#endif
+
+void
+block_deferrable_signals(sigset_t *where, sigset_t *old)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ block_signals(&deferrable_sigset, where, old);
+#endif
+}
+
+void
+block_blockable_signals(sigset_t *where, sigset_t *old)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ block_signals(&blockable_sigset, where, old);
+#endif
+}
+
+#ifndef LISP_FEATURE_SB_SAFEPOINT
+void
+block_gc_signals(sigset_t *where, sigset_t *old)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ block_signals(&gc_sigset, where, old);
+#endif
+}
+#endif
+
+void
+unblock_deferrable_signals(sigset_t *where, sigset_t *old)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ if (interrupt_handler_pending_p())
+ lose("unblock_deferrable_signals: losing proposition\n");
+#ifndef LISP_FEATURE_SB_SAFEPOINT
+ check_gc_signals_unblocked_or_lose(where);
+#endif
+ unblock_signals(&deferrable_sigset, where, old);
+#endif
+}
+
+void
+unblock_blockable_signals(sigset_t *where, sigset_t *old)
+{
+#if !defined(LISP_FEATURE_WIN32) || defined(LISP_FEATURE_SB_THREAD)
+ unblock_signals(&blockable_sigset, where, old);
+#endif
+}
+
+#ifndef LISP_FEATURE_SB_SAFEPOINT
+void
+unblock_gc_signals(sigset_t *where, sigset_t *old)
+{
+#ifndef LISP_FEATURE_WIN32
+ unblock_signals(&gc_sigset, where, old);
+#endif