Fix setup_mark_lock missing prototype
authorIvan Maidanski <ivmai@mail.ru>
Tue, 23 Sep 2014 19:20:08 +0000 (23:20 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 23 Sep 2014 19:20:08 +0000 (23:20 +0400)
(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.

include/private/pthread_support.h
misc.c
pthread_support.c

index 017f194..525a9aa 100644 (file)
@@ -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 32cbe24..e76aaaf 100644 (file)
--- 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
index db86ec8..9c0d4bc 100644 (file)
@@ -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;