From: Ivan Maidanski Date: Sat, 14 Jul 2012 08:51:01 +0000 (+0400) Subject: Recognize GC_SIG_SUSPEND and GC_SIG_THR_RESTART tuning macros in gc.h X-Git-Tag: gc7_4_0~260 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c47a8d3614a12fa84e29e26ebc94c88468b72bc;p=gc Recognize GC_SIG_SUSPEND and GC_SIG_THR_RESTART tuning macros in gc.h * include/gc.h (GC_SIG_SUSPEND, GC_SIG_THR_RESTART): New micro recognized to tune GC_INIT with the non-default signal to be used by GC to suspend (and resume, respectively) threads (only if GC_THREADS). * include/gc.h (GC_INIT_CONF_SUSPEND_SIGNAL, GC_INIT_CONF_THR_RESTART_SIGNAL): New macro (used internally by GC_INIT). * include/gc.h (GC_INIT): Invoke GC_INIT_CONF_SUSPEND_SIGNAL and GC_INIT_CONF_THR_RESTART_SIGNAL before GC_init(). --- diff --git a/include/gc.h b/include/gc.h index 98e1aa45..8a5546a9 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1556,6 +1556,19 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void); # define GC_INIT_CONF_TIME_LIMIT /* empty */ #endif +#if defined(GC_SIG_SUSPEND) && defined(GC_THREADS) +# define GC_INIT_CONF_SUSPEND_SIGNAL GC_set_suspend_signal(GC_SIG_SUSPEND) +#else +# define GC_INIT_CONF_SUSPEND_SIGNAL /* empty */ +#endif + +#if defined(GC_SIG_THR_RESTART) && defined(GC_THREADS) +# define GC_INIT_CONF_THR_RESTART_SIGNAL \ + GC_set_thr_restart_signal(GC_SIG_THR_RESTART) +#else +# define GC_INIT_CONF_THR_RESTART_SIGNAL /* empty */ +#endif + #ifdef GC_MAXIMUM_HEAP_SIZE /* Limit the heap size to the desired value (useful for debugging). */ /* The limit could be overridden either at the program start-up by */ @@ -1593,6 +1606,8 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void); GC_INIT_CONF_FREE_SPACE_DIVISOR; \ GC_INIT_CONF_FULL_FREQ; \ GC_INIT_CONF_TIME_LIMIT; \ + GC_INIT_CONF_SUSPEND_SIGNAL; \ + GC_INIT_CONF_THR_RESTART_SIGNAL; \ GC_INIT_CONF_MAXIMUM_HEAP_SIZE; \ GC_init(); /* real GC initialization */ \ GC_INIT_CONF_ROOTS; /* post-init */ \