From: Ivan Maidanski Date: Tue, 23 Sep 2014 19:20:08 +0000 (+0400) Subject: Fix setup_mark_lock missing prototype X-Git-Tag: gc7_6_0~205^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0615e61c920120f4689ae591f731151d5ca8523;p=gc Fix setup_mark_lock missing prototype (and do not call it if no parallel marker) * include/private/pthread_support.h (GC_setup_mark_lock): Remove prototype. * misc.c (GC_init): Remove GC_setup_mark_lock call (move it to GC_thr_init). * pthread_support.c (setup_mark_lock): Rename from GC_setup_mark_lock; add prototype (only if PARALLEL_MARK). * pthread_support.c (GC_thr_init): Call setup_mark_lock() unless available_markers_m1 is 0. --- diff --git a/include/private/pthread_support.h b/include/private/pthread_support.h index 017f1941..525a9aac 100644 --- a/include/private/pthread_support.h +++ b/include/private/pthread_support.h @@ -148,8 +148,6 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread( struct GC_stack_base *sb, void *arg); GC_INNER_PTHRSTART void GC_thread_exit_proc(void *); -GC_INNER void GC_setup_mark_lock(void); - #endif /* GC_PTHREADS && !GC_WIN32_THREADS */ #endif /* GC_PTHREAD_SUPPORT_H */ diff --git a/misc.c b/misc.c index 32cbe249..e76aaafc 100644 --- a/misc.c +++ b/misc.c @@ -888,9 +888,6 @@ GC_API void GC_CALL GC_init(void) /* else */ InitializeCriticalSection (&GC_allocate_ml); } # endif /* GC_WIN32_THREADS */ -# if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) - GC_setup_mark_lock(); -# endif /* GC_PTHREADS */ # if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS) InitializeCriticalSection(&GC_write_cs); # endif diff --git a/pthread_support.c b/pthread_support.c index db86ec84..9c0d4bc5 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1031,6 +1031,10 @@ static void fork_child_proc(void) ptr_t *startp, ptr_t *endp); #endif +#ifdef PARALLEL_MARK + static void setup_mark_lock(void); +#endif + /* We hold the allocation lock. */ GC_INNER void GC_thr_init(void) { @@ -1143,6 +1147,7 @@ GC_INNER void GC_thr_init(void) } else { /* Disable true incremental collection, but generational is OK. */ GC_time_limit = GC_TIME_UNLIMITED; + setup_mark_lock(); /* If we are using a parallel marker, actually start helper threads. */ start_mark_threads(); } @@ -2010,7 +2015,7 @@ static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER; } #endif /* GLIBC_2_19_TSX_BUG */ -GC_INNER void GC_setup_mark_lock(void) +static void setup_mark_lock(void) { # ifdef GLIBC_2_19_TSX_BUG pthread_mutexattr_t mattr;