2009-11-05 Ivan Maidanski <ivmai@mail.ru>
+ * win32_threads.c (GC_please_stop): If DllMain-based thread
+ registration is not compiled in then define GC_please_stop as
+ a non-volatile variable for assertion only.
+ * win32_threads.c (GC_stop_world): Set and clear only if defined.
+ * win32_threads.c (GC_stop_world): Add the comment for GC_printf()
+ usage (while holding GC_write_cs).
+ * win32_threads.c (GC_delete_gc_thread): Ditto.
+ * os_depc.c (GC_remove_protection): Ditto.
+
+2009-11-05 Ivan Maidanski <ivmai@mail.ru>
+
* pthread_support.c (GC_inner_start_routine): Join 3 sequential
GC_printf() calls into a single one (for DEBUG_THREADS).
* shortly. Ensure that all pages containing any part of the n hblks
* starting at h are no longer protected. If is_ptrfree is false,
* also ensure that they will subsequently appear to be dirty.
+ * Not allowed to call GC_printf (and the friends) here, see Win32
+ * GC_stop_world() for the information.
*/
GC_INNER void GC_remove_protection(struct hblk *h, word nblocks,
GC_bool is_ptrfree)
typedef struct GC_Thread_Rep * GC_thread;
typedef volatile struct GC_Thread_Rep * GC_vthread;
-/*
- * We assumed that volatile ==> memory ordering, at least among
- * volatiles. This code should consistently use atomic_ops.
- */
-
-STATIC volatile GC_bool GC_please_stop = FALSE;
+#ifndef GC_NO_DLLMAIN
+ /* We assumed that volatile ==> memory ordering, at least among */
+ /* volatiles. This code should consistently use atomic_ops. */
+ STATIC volatile GC_bool GC_please_stop = FALSE;
+#elif defined(GC_ASSERTIONS)
+ STATIC GC_bool GC_please_stop = FALSE;
+#endif
/*
* We track thread attachments while the world is supposed to be stopped.
GC_INLINE LONG GC_get_max_thread_index(void)
{
LONG my_max = GC_max_thread_index;
-
- if (my_max >= MAX_THREADS) return MAX_THREADS-1;
+ if (my_max >= MAX_THREADS) return MAX_THREADS - 1;
return my_max;
}
/* It is either called synchronously from the thread being */
/* deleted, or by the joining thread. */
/* In this branch asynchronous changes to *gc_id are possible. */
+ /* It's not allowed to call GC_printf (and the friends) here, */
+ /* see GC_stop_world() for the information. */
gc_id -> stack_base = 0;
gc_id -> id = 0;
# ifdef CYGWIN32
}
# endif /* PARALLEL_MARK */
- GC_please_stop = TRUE;
+# if !defined(GC_NO_DLLMAIN) || defined(GC_ASSERTIONS)
+ GC_please_stop = TRUE;
+# endif
# ifndef CYGWIN32
EnterCriticalSection(&GC_write_cs);
+ /* It's not allowed to call GC_printf() (and friends) here down to */
+ /* LeaveCriticalSection (same applies recursively to */
+ /* GC_get_max_thread_index(), GC_suspend(), GC_delete_gc_thread() */
+ /* (only if GC_win32_dll_threads), GC_size() and */
+ /* GC_remove_protection()). */
# endif
# ifndef GC_NO_DLLMAIN
if (GC_win32_dll_threads) {
}
}
}
- GC_please_stop = FALSE;
+# if !defined(GC_NO_DLLMAIN) || defined(GC_ASSERTIONS)
+ GC_please_stop = FALSE;
+# endif
}
#ifdef MSWINCE