From: Ivan Maidanski Date: Wed, 4 Jul 2012 15:59:34 +0000 (+0400) Subject: Move GC_get_suspend/thr_restart_signal to misc.c for NaCl and OpenBSD X-Git-Tag: gc7_4_0~261^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06d9d8cdff83489eefacdb518d1851408f7f4081;p=gc Move GC_get_suspend/thr_restart_signal to misc.c for NaCl and OpenBSD * misc.c (GC_get_suspend_signal, GC_get_thr_restart_signal): Define also for OpenBSD and NaCl targets in this file (always returns -1). * pthread_stop_world.c (GC_get_suspend_signal, GC_get_thr_restart_signal): Move function definition up to the definition of GC_sig_suspend and GC_sig_thr_restart variables (i.e., define function only if not OpenBSD and not NaCl target in this file). --- diff --git a/misc.c b/misc.c index 70203978..e3c3478c 100644 --- a/misc.c +++ b/misc.c @@ -507,17 +507,19 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size, UNLOCK(); } -#if defined(GC_DARWIN_THREADS) || defined(GC_WIN32_THREADS) +#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 int GC_CALL GC_get_suspend_signal(void) { - return -1; /* GC does not use signals to suspend threads. */ + return -1; } GC_API int GC_CALL GC_get_thr_restart_signal(void) { - return -1; /* GC does not use signals to restart threads. */ + return -1; } -#endif /* GC_DARWIN_THREADS || GC_WIN32_THREADS */ +#endif /* GC_DARWIN_THREADS || GC_WIN32_THREADS || ... */ #if !defined(_MAX_PATH) && (defined(MSWIN32) || defined(MSWINCE) \ || defined(CYGWIN32)) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 316ab4d1..74500c4b 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -144,6 +144,16 @@ 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 int GC_CALL GC_get_suspend_signal(void) +{ + return GC_sig_suspend; +} + +GC_API int GC_CALL GC_get_thr_restart_signal(void) +{ + return GC_sig_thr_restart; +} + #ifdef GC_EXPLICIT_SIGNALS_UNBLOCK /* Some targets (eg., Solaris) might require this to be called when */ /* doing thread registering from the thread destructor. */ @@ -892,22 +902,4 @@ GC_INNER void GC_stop_init(void) # endif /* !GC_OPENBSD_THREADS && !NACL */ } -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 -} - -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 */