UNLOCK();
}
-
-#ifdef THREADS
+#if defined(GC_DARWIN_THREADS) || defined(GC_WIN32_THREADS)
GC_API int GC_CALL GC_get_suspend_signal(void)
{
-# ifdef SIG_SUSPEND
- return SIG_SUSPEND;
-# else
- return -1;
-# endif
+ return -1; /* GC does not use signals to suspend threads. */
}
-# if defined(GC_DARWIN_THREADS) || defined(GC_WIN32_THREADS)
- GC_API int GC_CALL GC_get_thr_restart_signal(void)
- {
- return -1; /* GC does not use signals to restart threads. */
- }
-# endif
-#endif /* THREADS */
+ GC_API int GC_CALL GC_get_thr_restart_signal(void)
+ {
+ return -1; /* GC does not use signals to restart threads. */
+ }
+#endif /* GC_DARWIN_THREADS || GC_WIN32_THREADS */
#if !defined(_MAX_PATH) && (defined(MSWIN32) || defined(MSWINCE) \
|| defined(CYGWIN32))
act.sa_sigaction = GC_write_fault_handler;
(void)sigemptyset(&act.sa_mask);
# ifdef SIG_SUSPEND
- /* Arrange to postpone SIG_SUSPEND while we're in a write fault */
+ /* Arrange to postpone the signal while we are in a write fault */
/* handler. This effectively makes the handler atomic w.r.t. */
/* stopping the world for GC. */
- (void)sigaddset(&act.sa_mask, SIG_SUSPEND);
-# endif /* SIG_SUSPEND */
+ (void)sigaddset(&act.sa_mask, GC_get_suspend_signal());
+# endif
# endif
if (GC_print_stats == VERBOSE)
GC_log_printf(
# endif
#endif
+STATIC int GC_sig_suspend = SIG_SUSPEND;
STATIC int GC_sig_thr_restart = SIG_THR_RESTART;
#ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
{
sigset_t set;
sigemptyset(&set);
- sigaddset(&set, SIG_SUSPEND);
+ sigaddset(&set, GC_sig_suspend);
sigaddset(&set, GC_sig_thr_restart);
if (pthread_sigmask(SIG_UNBLOCK, &set, NULL) != 0)
ABORT("pthread_sigmask failed");
IF_CANCEL(int cancel_state;)
AO_t my_stop_count = AO_load(&GC_stop_count);
- if ((signed_word)sig_arg != SIG_SUSPEND)
+ if ((signed_word)sig_arg != GC_sig_suspend)
ABORT("Bad signal in suspend_handler");
DISABLE_CANCEL(cancel_state);
*(ptr_t *)((char *)p -> id + UTHREAD_SP_OFFSET);
# else
# ifndef PLATFORM_ANDROID
- result = pthread_kill(p -> id, SIG_SUSPEND);
+ result = pthread_kill(p -> id, GC_sig_suspend);
# else
- result = android_thread_kill(p -> kernel_id, SIG_SUSPEND);
+ result = android_thread_kill(p -> kernel_id, GC_sig_suspend);
# endif
switch(result) {
case ESRCH:
# else
act.sa_handler = GC_suspend_handler;
# endif
- if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
+ if (sigaction(GC_sig_suspend, &act, NULL) != 0) {
ABORT("Cannot set SIG_SUSPEND handler");
}
# endif /* !GC_OPENBSD_THREADS && !NACL */
}
- GC_API int GC_CALL GC_get_thr_restart_signal(void)
- {
-# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
- return GC_sig_thr_restart;
-# else
- return -1;
-# endif
- }
+GC_API int GC_CALL GC_get_suspend_signal(void)
+{
+# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
+ return GC_sig_suspend;
+# else
+ return -1;
+# endif
+}
-#endif
+GC_API int GC_CALL GC_get_thr_restart_signal(void)
+{
+# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
+ return GC_sig_thr_restart;
+# else
+ return -1;
+# endif
+}
+
+#endif /* GC_PTHREADS && !GC_DARWIN_THREADS && !GC_WIN32_THREADS */