summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorJean-Claude Beaudoin <jean.claude.beaudoin@gmail.com>2012-07-04 20:53:57 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-07-04 20:53:57 +0400
commitee0e1619e50b937de34582acf3b45bf269468fdf (patch)
tree025eef254f8768bf30c803c748e862782776425a /pthread_stop_world.c
parent06d9d8cdff83489eefacdb518d1851408f7f4081 (diff)
downloadbdwgc-ee0e1619e50b937de34582acf3b45bf269468fdf.tar.gz
Add thread suspend/resume signals public setters (POSIX threads)
* include/gc.h (GC_set_suspend_signal, GC_set_thr_restart_signal): Add public function declaration (to specify non-default signals to suspend/resume threads). * include/gc.h (GC_get_suspend_signal, GC_get_thr_restart_signal): Update comment. * misc.c (GC_set_suspend_signal, GC_set_thr_restart_signal): Add public no-op function (only for Darwin, OpenBSD, Win32 and NaCl). * pthread_stop_world.c (GC_set_suspend_signal, GC_set_thr_restart_signal): Add public setter to alter the default signals used to suspend and resume threads (only if not OpenBSD or NaCl); has no effect if GC is initialized.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 74500c4b..231ceeee 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -144,6 +144,20 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE;
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;