From: Ivan Maidanski Date: Tue, 20 Nov 2012 16:55:55 +0000 (+0400) Subject: Minor code refactoring of GC fork handlers (remove GC prefix) X-Git-Tag: gc7_4_0~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47e3714fd5b9e05c7b590dc4b5ee54489cfaf721;p=gc Minor code refactoring of GC fork handlers (remove GC prefix) * pthread_support.c (GC_fork_prepare_proc, GC_fork_parent_proc, GC_fork_child_proc): Declare as "static" instead of STATIC; remove "GC_" prefix. * win32_threads.c (GC_fork_prepare_proc, GC_fork_parent_proc, GC_fork_child_proc): Likewise. * pthread_support.c (GC_fork_parent_proc): Refine comment. * pthread_support.c (GC_thr_init): Remove "GC_" prefix for fork_prepare/parent/child_proc (only if CAN_HANDLE_FORK). * win32_threads.c (GC_thr_init): Likewise. --- diff --git a/pthread_support.c b/pthread_support.c index 84c95fbf..7b53fe0a 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -941,7 +941,7 @@ IF_CANCEL(static int fork_cancel_state;) /* protected by allocation lock. */ /* Called before a fork() */ -STATIC void GC_fork_prepare_proc(void) +static void fork_prepare_proc(void) { /* Acquire all relevant locks, so that after releasing the locks */ /* the child will see a consistent state in which monitor */ @@ -964,8 +964,8 @@ STATIC void GC_fork_prepare_proc(void) # endif } -/* Called in parent after a fork() */ -STATIC void GC_fork_parent_proc(void) +/* Called in parent after a fork() (even if the latter failed). */ +static void fork_parent_proc(void) { # if defined(PARALLEL_MARK) if (GC_parallel) @@ -976,7 +976,7 @@ STATIC void GC_fork_parent_proc(void) } /* Called in child after a fork() */ -STATIC void GC_fork_child_proc(void) +static void fork_child_proc(void) { /* Clean up the thread table, so that just our thread is left. */ # if defined(PARALLEL_MARK) @@ -1010,8 +1010,8 @@ GC_INNER void GC_thr_init(void) # ifdef CAN_HANDLE_FORK /* Prepare for forks if requested. */ if (GC_handle_fork - && pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc, - GC_fork_child_proc) != 0) + && pthread_atfork(fork_prepare_proc, fork_parent_proc, + fork_child_proc) != 0) ABORT("pthread_atfork failed"); # endif # ifdef INCLUDE_LINUX_THREAD_DESCR diff --git a/win32_threads.c b/win32_threads.c index 45466bee..4e25bc71 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1048,7 +1048,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, # endif } - STATIC void GC_fork_prepare_proc(void) + static void fork_prepare_proc(void) { LOCK(); # ifdef PARALLEL_MARK @@ -1062,7 +1062,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, # endif } - STATIC void GC_fork_parent_proc(void) + static void fork_parent_proc(void) { # ifdef PARALLEL_MARK if (GC_parallel) @@ -1071,7 +1071,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, UNLOCK(); } - STATIC void GC_fork_child_proc(void) + static void fork_child_proc(void) { # ifdef PARALLEL_MARK if (GC_parallel) { @@ -2405,8 +2405,8 @@ GC_INNER void GC_thr_init(void) # ifdef CAN_HANDLE_FORK /* Prepare for forks if requested. */ if (GC_handle_fork - && pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc, - GC_fork_child_proc) != 0) + && pthread_atfork(fork_prepare_proc, fork_parent_proc, + fork_child_proc) != 0) ABORT("pthread_atfork failed"); # endif