summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-22 17:00:59 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:51 +0200
commitc06769bfb05036d0ab57114d3b4568d8f743ad49 (patch)
treea0715b580d2c0bd3b565c6fa42109e2671bc6f0c /win32_threads.c
parentbad4c7acb6060861cd4be55968c1f58b2026a747 (diff)
2009-10-22 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_collection_in_progress): Move the prototype to gc_priv.h. * gc_dlopen.c (GC_collection_in_progress): Ditto. * pthread_support.c (GC_collection_in_progress): Ditto. * misc.c (GC_init_parallel): Ditto. * pthread_support.c (GC_init_parallel): Ditto. * win32_threads.c (GC_init_parallel): Ditto. * darwin_stop_world.c (GC_thr_init): Ditto. * misc.c (GC_thr_init): Ditto. * pthread_stop_world.c (GC_thr_init): Ditto. * pthread_support.c (GC_thr_init): Ditto. * blacklst.c (GC_clear_bl, GC_copy_bl, GC_number_stack_black_listed): Make STATIC. * dbg_mlc.c (GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer): Ditto. * malloc.c (GC_alloc_large_and_clear): Ditto. * mark.c (GC_push_selected, GC_push_marked1, GC_push_marked2, GC_push_marked4, GC_push_marked, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Ditto. * misc.c (GC_clear_stack_inner): Ditto. * os_dep.c (GC_repeat_read, GC_default_push_other_roots): Ditto. * darwin_stop_world.c (FindTopOfStack): Make static; define only if not DARWIN_DONT_PARSE_STACK. * dbg_mlc.c (GC_debug_free_inner): Define only if DBG_HDRS_ALL. * dyn_load.c (GC_repeat_read): Remove unused prototype. * include/private/gc_pmark.h (GC_find_start): Ditto. * misc.c (GC_read, GC_register_finalizer_no_order): Ditto. * dyn_load.c (GC_segment_is_thread_stack): Add prototype (only if THREADS). * dyn_load.c (GC_register_main_static_data): Define only if DYNAMIC_LOADING. * finalize.c (GC_enqueue_all_finalizers): Remove unnecessary tail "return" statement. * gc_dlopen.c (GC_SOLARIS_THREADS): Don't recognize (since implies GC_PTHREADS). * include/gc.h: Fix a typo. * include/gc_inline.h (GC_ASSERT): Define (if not defined) since the header is public. * include/gc_inline.h (GC_generic_malloc_many): New public function declaration. * mallocx.c (GC_generic_malloc_many): Make public. * include/private/gc_priv.h (GC_INNER): Use visibility attribute (if available). * include/private/gc_priv.h (GC_EXTERN): Define using GC_INNER. * include/private/gc_priv.h: Include atomic_ops.h if THREADS and MPROTECT_VDB. * os_dep.c: Don't include atomic_ops.h * win32_threads.c: Ditto. * include/private/gc_priv.h (GC_push_selected, GC_push_regs, GC_push_marked, GC_number_stack_black_listed, GC_alloc_large_and_clear, GC_reclaim_or_delete_all, GC_generic_malloc_many, GC_make_closure, GC_debug_invoke_finalizer, GC_print_obj, GC_page_was_ever_dirty): Remove the prototype. * mark.c (GC_page_was_ever_dirty): Add prototype (only if PROC_VDB). * include/private/gc_priv.h (GC_push_next_marked_dirty, GC_push_next_marked, GC_push_next_marked_uncollectable): Move the prototype to mark.c. * include/private/gc_priv.h (GC_is_static_root): Declare only if not THREADS. * include/private/gc_priv.h (GC_free_inner): Declare only if THREADS. * include/private/gc_priv.h (GC_debug_free_inner): Declare only if THREADS and DBG_HDRS_ALL. * include/private/gc_priv.h (GC_markers): Declare GC_markers only if PARALLEL_MARK. * include/private/gc_priv.h (GC_register_main_static_data): Move the prototype to misc.c. * mach_dep.c (GC_push_regs): Make STATIC; define only along with HAVE_PUSH_REGS definition. * mach_dep.c (GC_clear_stack_inner): Replace K&R-style function definition with the ANSI C one. * mark.c (GC_started_thread_while_stopped): Declared only if not GNU C. * win32_threads.c (GC_started_thread_while_stopped): Don't define if GNU C. * mark.c (GC_mark_from): Avoid unbalanced brackets in #if-#else-#endif blocks. * mark_rts.c (GC_is_static_root): Define only if not THREADS. * os_dep.c (GC_get_stack_base): Make public (for OpenBSD). * os_dep.c (GC_page_was_ever_dirty): Comment out the function except for PROC_VDB. * tests/test.c (main): Don't reference GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer, GC_page_was_ever_dirty, GC_is_fresh (in GC_noop). * thread_local_alloc.c: Don't include "gc_inline.h". * win32_threads.c (GC_write_fault_handler): Declare only if MPROTECT_VDB.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/win32_threads.c b/win32_threads.c
index dd8268b..e13b06a 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -155,8 +155,6 @@ GC_INNER GC_bool GC_need_to_lock = FALSE;
static GC_bool parallel_initialized = FALSE;
-void GC_init_parallel(void);
-
/* GC_use_DllMain() is currently incompatible with pthreads and WinCE. */
/* It might be possible to get DllMain-based thread registration to */
/* work with Cygwin, but if you try, you are on your own. */
@@ -274,24 +272,26 @@ STATIC volatile GC_bool GC_please_stop = FALSE;
STATIC AO_t GC_attached_thread = FALSE;
#endif
-/* Return TRUE if an thread was attached since we last asked or */
-/* since GC_attached_thread was explicitly reset. */
-GC_bool GC_started_thread_while_stopped(void)
-{
-#ifndef GC_NO_DLLMAIN
- AO_t result;
+#if !defined(__GNUC__)
+ /* Return TRUE if an thread was attached since we last asked or */
+ /* since GC_attached_thread was explicitly reset. */
+ GC_bool GC_started_thread_while_stopped(void)
+ {
+# ifndef GC_NO_DLLMAIN
+ AO_t result;
- if (GC_win32_dll_threads) {
- AO_nop_full(); /* Prior heap reads need to complete earlier. */
- result = AO_load(&GC_attached_thread);
- if (result) {
- AO_store(&GC_attached_thread, FALSE);
- }
- return ((GC_bool)result);
+ if (GC_win32_dll_threads) {
+ AO_nop_full(); /* Prior heap reads need to complete earlier. */
+ result = AO_load(&GC_attached_thread);
+ if (result) {
+ AO_store(&GC_attached_thread, FALSE);
+ }
+ return ((GC_bool)result);
+ }
+# endif
+ return FALSE;
}
-#endif
- return FALSE;
-}
+#endif /* !__GNUC__ */
/* Thread table used if GC_win32_dll_threads is set. */
/* This is a fixed size array. */
@@ -351,7 +351,10 @@ STATIC GC_thread GC_new_thread(DWORD id)
return(result);
}
-LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
+#ifdef MPROTECT_VDB
+ LONG WINAPI GC_write_fault_handler(
+ struct _EXCEPTION_POINTERS *exc_info);
+#endif
#if defined(GWW_VDB) && defined(MPROTECT_VDB)
GC_bool GC_gww_dirty_init(void);
@@ -917,10 +920,6 @@ void GC_push_thread_structures(void)
# endif
}
-#if defined(MPROTECT_VDB)
-# include "atomic_ops.h"
-#endif
-
/* Suspend the given thread, if it's still active. */
STATIC void GC_suspend(GC_thread t)
{
@@ -1334,7 +1333,7 @@ void GC_push_all_stacks(void)
/* is found, both *hi and *lo will be set to an address */
/* higher than limit. */
void GC_get_next_stack(char *start, char *limit,
- char **lo, char **hi)
+ char **lo, char **hi)
{
int i;
char * current_min = ADDR_LIMIT; /* Least in-range stack base */