#endif
#ifdef GC_THREADS
- /* Return the signal number (constant) used by the garbage collector */
- /* to suspend threads on POSIX systems. Return -1 otherwise. */
+ /* Suggest the GC to use the specific signal to suspend threads. */
+ /* Has no effect after GC_init and on non-POSIX systems. */
+ GC_API void GC_CALL GC_set_suspend_signal(int);
+
+ /* Suggest the GC to use the specific signal to resume threads. */
+ /* Has no effect after GC_init and on non-POSIX systems. */
+ GC_API void GC_CALL GC_set_thr_restart_signal(int);
+
+ /* Return the signal number (constant after initialization) used by */
+ /* the GC to suspend threads on POSIX systems. Return -1 otherwise. */
GC_API int GC_CALL GC_get_suspend_signal(void);
- /* Return the signal number (constant) used by the garbage collector */
- /* to restart (resume) threads on POSIX systems. Return -1 otherwise. */
+ /* Return the signal number (constant after initialization) used by */
+ /* the garbage collector to restart (resume) threads on POSIX */
+ /* systems. Return -1 otherwise. */
GC_API int GC_CALL GC_get_thr_restart_signal(void);
/* Explicitly enable GC_register_my_thread() invocation. */
#if defined(GC_DARWIN_THREADS) || defined(GC_OPENBSD_THREADS) \
|| defined(GC_WIN32_THREADS) || (defined(NACL) && defined(THREADS))
/* GC does not use signals to suspend and restart threads. */
+ GC_API void GC_CALL GC_set_suspend_signal(int sig GC_ATTR_UNUSED)
+ {
+ /* empty */
+ }
+
+ GC_API void GC_CALL GC_set_thr_restart_signal(int sig GC_ATTR_UNUSED)
+ {
+ /* empty */
+ }
+
GC_API int GC_CALL GC_get_suspend_signal(void)
{
return -1;
STATIC int GC_sig_suspend = SIG_SUSPEND;
STATIC int GC_sig_thr_restart = SIG_THR_RESTART;
+GC_API void GC_CALL GC_set_suspend_signal(int sig)
+{
+ if (GC_is_initialized) return;
+
+ GC_sig_suspend = sig;
+}
+
+GC_API void GC_CALL GC_set_thr_restart_signal(int sig)
+{
+ if (GC_is_initialized) return;
+
+ GC_sig_thr_restart = sig;
+}
+
GC_API int GC_CALL GC_get_suspend_signal(void)
{
return GC_sig_suspend;