From fc9e28ff343e0c1db530828ab7f07a8fd6b86d61 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Fri, 16 Dec 2011 09:46:38 +0100 Subject: [PATCH 1/5] Added GC_get_thr_restart_signal() --- include/gc.h | 4 ++++ pthread_stop_world.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/gc.h b/include/gc.h index f67e4eaa6..d7aae6b12 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1082,6 +1082,10 @@ GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func /* fn */, /* 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 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. */ /* Done implicitly if a GC thread-creation function is called (or */ /* implicit thread registration is activated). Otherwise, it must */ diff --git a/pthread_stop_world.c b/pthread_stop_world.c index a94517e73..f71dbca4e 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -872,4 +872,17 @@ GC_INNER void GC_stop_init(void) # endif /* !GC_OPENBSD_THREADS && !NACL */ } + GC_API int GC_CALL GC_get_thr_restart_signal(void) + { + return SIG_THR_RESTART; + } + +#else /* defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ + !defined(GC_DARWIN_THREADS) */ + + GC_API int GC_CALL GC_get_thr_restart_signal(void) + { + return -1; + } + #endif From 670a7ee591f0eca75ff33ed3f5e28e974028c5c0 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 19 Dec 2011 16:05:39 +0400 Subject: [PATCH 2/5] Fix GC_get_thr_restart_signal for OpenBSD and NaCl * include/gc.h (GC_get_thr_restart_signal): Refine comment. * pthread_stop_world.c (GC_get_thr_restart_signal): Return -1 for OpenBSD and NaCl. --- include/gc.h | 2 +- pthread_stop_world.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/gc.h b/include/gc.h index d7aae6b12..a7fd44908 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1083,7 +1083,7 @@ GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func /* fn */, GC_API int GC_CALL GC_get_suspend_signal(void); /* Return the signal number (constant) used by the garbage collector */ - /* to restart threads on POSIX systems. Return -1 otherwise. */ + /* 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. */ diff --git a/pthread_stop_world.c b/pthread_stop_world.c index f71dbca4e..edbed2b17 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -874,7 +874,11 @@ GC_INNER void GC_stop_init(void) GC_API int GC_CALL GC_get_thr_restart_signal(void) { +# if !defined(GC_OPENBSD_THREADS) && !defined(NACL) return SIG_THR_RESTART; +# else + return -1; +# endif } #else /* defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ From 0ea97b54515ee1731aec2f22850d2bc6f2e289e1 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 19 Dec 2011 16:06:00 +0400 Subject: [PATCH 3/5] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 36f8bb5f7..09816f605 100644 --- a/AUTHORS +++ b/AUTHORS @@ -139,6 +139,7 @@ Jacob Navia Jakub Jelinek James Clark James Dominy +Jan Wielemaker Jani Kajala Jean-Baptiste Nivois Jean-Claude Beaudoin From 37910c0474c89a21e040d10d25c975099d5804dd Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 19 Dec 2011 16:27:18 +0400 Subject: [PATCH 4/5] Fix GC_get_thr_restart_signal for Darwin and Win32 * misc.c (GC_get_thr_restart_signal): Implement for Darwin and Win32 (always returns -1) if THREADS. * pthread_stop_world.c (GC_get_thr_restart_signal): Remove implementation for Darwin/Win32 (since the file might not be included for these targets). --- misc.c | 7 +++++++ pthread_stop_world.c | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/misc.c b/misc.c index e825705ee..ac7859226 100644 --- a/misc.c +++ b/misc.c @@ -467,6 +467,13 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size, return -1; # endif } + +# 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 */ #ifdef GC_READ_ENV_FILE diff --git a/pthread_stop_world.c b/pthread_stop_world.c index edbed2b17..a354a84db 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -881,12 +881,4 @@ GC_INNER void GC_stop_init(void) # endif } -#else /* defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ - !defined(GC_DARWIN_THREADS) */ - - GC_API int GC_CALL GC_get_thr_restart_signal(void) - { - return -1; - } - #endif From 45aacf595a6d406be96a1f01347c9214f64d0faf Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 19 Dec 2011 16:29:23 +0400 Subject: [PATCH 5/5] Update ChangeLog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 71211ca17..f4d53e363 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ ========================= * Add GC_UNDERSCORE_STDCALL, UNICODE macro templates to configure (Win32). +* Add GC_get_thr_restart_signal API entry. * Add GC_move_disappearing_link() API entry. * Add TODO file. * Add configure option to compile all library .c files into single gc.o.