]> granicus.if.org Git - gc/commitdiff
Fix GC_marker_Id elements initialization (WinCE)
authorIvan Maidanski <ivmai@mail.ru>
Sun, 18 Nov 2012 19:20:23 +0000 (23:20 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 18 Nov 2012 19:20:23 +0000 (23:20 +0400)
* 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).

win32_threads.c

index 66a983ca3ee8873e5dc51e3c2b7f26e9544a7544..ec62dd5d5093ee8d8ee7ffc6eebb8daf805b46d9 100644 (file)
@@ -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 */,