From: Ivan Maidanski Date: Wed, 11 Sep 2019 20:03:49 +0000 (+0300) Subject: Do not define GC_write_cs for Xbox One target X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d73c341351fff11b638a5d27168a24922077ce7f;p=gc Do not define GC_write_cs for Xbox One target (fix of commit d16debf3e) Issue #173 (bdwgc). GC_write_cs is not used in GC_write thus there is no need to define and use it in GC_stop_world. * include/private/gc_priv.h [THREADS && MSWIN_XBOX1] (GC_write_cs): Do not declare. * misc.c [THREADS && MSWIN_XBOX1] (GC_write_cs): Do not define. * win32_threads.c (GC_stop_world): Call EnterCriticalSection() and LeaveCriticalSection() only if MSWIN32 or MSWINCE. --- diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index ef81ae63..03fc1d2a 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2348,15 +2348,15 @@ GC_EXTERN signed_word GC_bytes_found; #endif #ifdef THREADS -# if defined(MSWIN32) || defined(MSWINCE) || defined(MSWIN_XBOX1) +# if defined(MSWIN32) || defined(MSWINCE) GC_EXTERN CRITICAL_SECTION GC_write_cs; /* defined in misc.c */ -# endif -# if defined(GC_ASSERTIONS) && (defined(MSWIN32) || defined(MSWINCE)) - GC_EXTERN GC_bool GC_write_disabled; +# ifdef GC_ASSERTIONS + GC_EXTERN GC_bool GC_write_disabled; /* defined in win32_threads.c; */ /* protected by GC_write_cs. */ -# endif +# endif +# endif /* MSWIN32 || MSWINCE */ # if defined(GC_DISABLE_INCREMENTAL) || defined(HAVE_LOCKFREE_AO_OR) # define GC_acquire_dirty_lock() (void)0 # define GC_release_dirty_lock() (void)0 diff --git a/misc.c b/misc.c index c063b26c..9d02f65e 100644 --- a/misc.c +++ b/misc.c @@ -749,8 +749,7 @@ GC_API int GC_CALL GC_is_init_called(void) return GC_is_initialized; } -#if (defined(MSWIN32) || defined(MSWINCE) || defined(MSWIN_XBOX1)) \ - && defined(THREADS) +#if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS) GC_INNER CRITICAL_SECTION GC_write_cs; #endif diff --git a/win32_threads.c b/win32_threads.c index f6049b39..dac29e10 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1357,18 +1357,16 @@ GC_INNER void GC_stop_world(void) # if !defined(GC_NO_THREADS_DISCOVERY) || defined(GC_ASSERTIONS) GC_please_stop = TRUE; # endif -# ifndef CYGWIN32 -# ifndef MSWIN_XBOX1 - GC_ASSERT(!GC_write_disabled); -# endif +# if defined(MSWIN32) || defined(MSWINCE) + GC_ASSERT(!GC_write_disabled); EnterCriticalSection(&GC_write_cs); -# endif -# if defined(GC_ASSERTIONS) && (defined(MSWIN32) || defined(MSWINCE)) /* It's not allowed to call GC_printf() (and friends) here down to */ /* LeaveCriticalSection (same applies recursively to GC_suspend, */ /* GC_delete_gc_thread_no_free, GC_get_max_thread_index, GC_size */ /* and GC_remove_protection). */ - GC_write_disabled = TRUE; +# ifdef GC_ASSERTIONS + GC_write_disabled = TRUE; +# endif # endif # ifndef GC_NO_THREADS_DISCOVERY if (GC_win32_dll_threads) { @@ -1401,10 +1399,10 @@ GC_INNER void GC_stop_world(void) } } } -# if defined(GC_ASSERTIONS) && (defined(MSWIN32) || defined(MSWINCE)) - GC_write_disabled = FALSE; -# endif -# ifndef CYGWIN32 +# if defined(MSWIN32) || defined(MSWINCE) +# ifdef GC_ASSERTIONS + GC_write_disabled = FALSE; +# endif LeaveCriticalSection(&GC_write_cs); # endif # ifdef PARALLEL_MARK