# define GC_EXPLICIT_SIGNALS_UNBLOCK
#endif
+#if !defined(NO_SIGNALS_UNBLOCK_IN_MAIN) && defined(GC_NO_PTHREAD_SIGMASK)
+# define NO_SIGNALS_UNBLOCK_IN_MAIN
+#endif
+
#if !defined(NO_MARKER_SPECIAL_SIGMASK) \
&& (defined(NACL) || defined(GC_WIN32_PTHREADS))
/* Either there is no pthread_sigmask(), or GC marker thread cannot */
? GC_sig_thr_restart : SIG_THR_RESTART;
}
-#ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
+#if defined(GC_EXPLICIT_SIGNALS_UNBLOCK) \
+ || !defined(NO_SIGNALS_UNBLOCK_IN_MAIN)
/* Some targets (e.g., Solaris) might require this to be called when */
/* doing thread registering from the thread destructor. */
GC_INNER void GC_unblock_gc_signals(void)
if (GC_retry_signals) {
GC_COND_LOG_PRINTF("Will retry suspend signal if necessary\n");
}
+# ifndef NO_SIGNALS_UNBLOCK_IN_MAIN
+ /* Explicitly unblock the signals once before new threads creation. */
+ GC_unblock_gc_signals();
+# endif
# endif /* !GC_OPENBSD_UTHREADS && !NACL */
}