+2010-10-15 Ivan Maidanski <ivmai@mail.ru>
+
+ * darwin_stop_world.c (GC_mach_threads): Remove static qualifier.
+ * darwin_stop_world.c (GC_stop_init): Remove (as we do not need to
+ really clear GC_mach_threads[]).
+ * darwin_stop_world.c (GC_stop_world): Reset GC_mach_threads_count
+ (instead of calling GC_stop_init).
+ * include/private/pthread_support.h (GC_stop_init): Remove proto.
+ * pthread_support.c (GC_stop_init): Add proto (unless Darwin).
+ * pthread_support.c (GC_thr_init): Don't call GC_stop_init() if
+ GC_DARWIN_THREADS.
+
2010-10-14 Ivan Maidanski <ivmai@mail.ru>
* darwin_stop_world.c (GC_stack_range_for): New static function
GC_bool already_suspended;
};
-static struct GC_mach_thread GC_mach_threads[GC_MAX_MACH_THREADS];
+struct GC_mach_thread GC_mach_threads[GC_MAX_MACH_THREADS];
STATIC int GC_mach_threads_count = 0;
/* FIXME: it is better to implement GC_mach_threads as a hash set. */
-GC_INNER void GC_stop_init(void)
-{
- int i;
- for (i = 0; i < GC_MAX_MACH_THREADS; i++) {
- GC_mach_threads[i].thread = 0;
- GC_mach_threads[i].already_suspended = FALSE;
- }
- GC_mach_threads_count = 0;
-}
-
#ifdef PARALLEL_MARK
GC_INNER GC_bool GC_is_mach_marker(thread_act_t thread);
#endif
thread_act_array_t act_list, prev_list;
mach_msg_type_number_t listcount, prevcount;
-# ifdef DEBUG_THREADS
- GC_printf("Stopping the world from thread 0x%lx\n",
- (unsigned long)my_thread);
-# endif
-
- /* clear out the mach threads list table */
- GC_stop_init();
+# ifdef DEBUG_THREADS
+ GC_printf("Stopping the world from thread 0x%lx\n",
+ (unsigned long)my_thread);
+# endif
+ /* Clear out the mach threads list table. We do not need to really */
+ /* clear GC_mach_threads[] as it is used only in the range from 0 to */
+ /* GC_mach_threads_count-1, inclusive. */
+ GC_mach_threads_count = 0;
/* Make sure all free list construction has stopped before we */
/* start. No new construction can start, since free list */
GC_INNER GC_thread GC_lookup_thread(pthread_t id);
-GC_INNER void GC_stop_init(void);
-
GC_EXTERN GC_bool GC_in_thread_creation;
/* We may currently be in thread creation or destruction. */
/* Only set to TRUE while allocation lock is held. */
__thread int GC_dummy_thread_local;
#endif
+#ifndef GC_DARWIN_THREADS
+ GC_INNER void GC_stop_init(void); /* defined in pthread_stop_world.c */
+#endif
+
/* We hold the allocation lock. */
GC_INNER void GC_thr_init(void)
{
t -> flags = DETACHED | MAIN_THREAD;
}
- GC_stop_init();
+# ifndef GC_DARWIN_THREADS
+ GC_stop_init();
+# endif
/* Set GC_nprocs. */
{