From: Ivan Maidanski Date: Sun, 18 Nov 2012 19:20:23 +0000 (+0400) Subject: Fix GC_marker_Id elements initialization (WinCE) X-Git-Tag: gc7_4_0~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33bd64cdecdf38880576942a1c81707d6804b5ba;p=gc Fix GC_marker_Id elements initialization (WinCE) * win32_threads.c (GC_marker_cv, GC_marker_Id): Move variable definition up to precede GC_mark_thread (only if PARALLEL_MARK and DONT_USE_SIGNALANDWAIT). * win32_threads.c (GC_mark_thread): Set corresponding element of GC_marker_Id[] to GetCurrentThreadId() value (only if PARALLEL_MARK and DONT_USE_SIGNALANDWAIT). * win32_threads.c (start_mark_threads): Do not set GC_marker_Id[] elements here because GetCurrentThreadId should be invoked from the corresponding thread; update comment (only if PARALLEL_MARK and DONT_USE_SIGNALANDWAIT). --- diff --git a/win32_threads.c b/win32_threads.c index 66a983ca..ec62dd5d 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1650,6 +1650,18 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # define GC_PTHREADS_PARAMARK # endif +# if !defined(GC_PTHREADS_PARAMARK) && defined(DONT_USE_SIGNALANDWAIT) + STATIC HANDLE GC_marker_cv[MAX_MARKERS - 1] = {0}; + /* Events with manual reset (one for each */ + /* mark helper). */ + + STATIC DWORD GC_marker_Id[MAX_MARKERS - 1] = {0}; + /* This table is used for mapping helper */ + /* threads ID to mark helper index (linear */ + /* search is used since the mapping contains */ + /* only a few entries). */ +# endif + /* GC_mark_thread() is the same as in pthread_support.c */ # ifdef GC_PTHREADS_PARAMARK STATIC void * GC_mark_thread(void * id) @@ -1668,6 +1680,9 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # ifdef IA64 marker_bsp[(word)id] = GC_save_regs_in_stack(); # endif +# if !defined(GC_PTHREADS_PARAMARK) && defined(DONT_USE_SIGNALANDWAIT) + GC_marker_Id[(word)id] = GetCurrentThreadId(); +# endif for (;; ++my_mark_no) { if (my_mark_no - GC_mark_no > (word)2) { @@ -1824,18 +1839,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # else /* ! GC_PTHREADS_PARAMARK */ -# ifdef DONT_USE_SIGNALANDWAIT - STATIC HANDLE GC_marker_cv[MAX_MARKERS - 1] = {0}; - /* Events with manual reset (one for each */ - /* mark helper). */ - - STATIC DWORD GC_marker_Id[MAX_MARKERS - 1] = {0}; - /* This table is used for mapping helper */ - /* threads ID to mark helper index (linear */ - /* search is used since the mapping contains */ - /* only a few entries). */ -# endif - # ifndef MARK_THREAD_STACK_SIZE # define MARK_THREAD_STACK_SIZE 0 /* default value */ # endif @@ -1857,10 +1860,9 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # endif # ifdef DONT_USE_SIGNALANDWAIT - /* Initialize GC_marker_cv[] and GC_marker_Id[] fully before */ - /* starting the first helper thread. */ + /* Initialize GC_marker_cv[] fully before starting the */ + /* first helper thread. */ for (i = 0; i < GC_markers_m1; ++i) { - GC_marker_Id[i] = GetCurrentThreadId(); if ((GC_marker_cv[i] = CreateEvent(NULL /* attrs */, TRUE /* isManualReset */, FALSE /* initialState */,