diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2019-09-12 10:08:06 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2019-09-12 11:08:56 +0300 |
commit | c2b191639b73d761d94f5deea8b8a65d44fd57f0 (patch) | |
tree | 81e9d724633024c244a4747442fa2486a428bd3e /win32_threads.c | |
parent | d73c341351fff11b638a5d27168a24922077ce7f (diff) | |
download | bdwgc-c2b191639b73d761d94f5deea8b8a65d44fd57f0.tar.gz |
New macro (CONSOLE_LOG) to enable logging to console on Win32
The macro is effective only on the Win32 (MSWIN32) target. It changes
the logging facility to be the same as on Cygwin and other Unix-like
targets.
* doc/README.macros (CONSOLE_LOG): Document new macro.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG]
(GC_write_cs): Do not declare.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG
&& GC_ASSERTIONS] (GC_write_disabled): Likewise.
* misc.c [CONSOLE_LOG && MSWIN32]: Include fcntl.h, sys/types.h,
sys/stat.h.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_write_cs):
Do not define.
* win32_threads.c [GC_ASSERTIONS && MSWIN32 && CONSOLE_LOG]
(GC_write_disabled): Likewise.
* misc.c [MSWIN32 && CONSOLE_LOG] (GC_stdout, GC_stderr, GC_log): Define
STATIC variable (of int type).
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_init): Do not
call InitializeCriticalSection(&GC_write_cs); handle GC_LOG_FILE and
GC_ONLY_LOG_TO_FILE environment variables.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_deinit): Do
not call DeleteCriticalSection(&GC_write_cs).
* misc.c [MSWIN32 && CONSOLE_LOG] (IF_NEED_TO_LOCK, getWinRTLogPath,
GC_CreateLogFile): Do not define.
* misc.c [!PCR && !SMALL_CONFIG && !GC_ANDROID_LOG && GC_WIN32_THREADS
&& GC_ASSERTIONS MSWIN32 && CONSOLE_LOG] (GC_default_on_abort): Do not
use GC_write_disabled.
* win32_threads.c [MSWIN32 && CONSOLE_LOG] (GC_stop_world): Do not use
GC_write_disabled and GC_write_cs.
Diffstat (limited to 'win32_threads.c')
-rw-r--r-- | win32_threads.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/win32_threads.c b/win32_threads.c index dac29e10..6bb99bb9 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1332,7 +1332,8 @@ STATIC void GC_suspend(GC_thread t) GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, THREAD_HANDLE(t)); } -#if defined(GC_ASSERTIONS) && (defined(MSWIN32) || defined(MSWINCE)) +#if defined(GC_ASSERTIONS) \ + && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE)) GC_INNER GC_bool GC_write_disabled = FALSE; /* TRUE only if GC_stop_world() acquired GC_write_cs. */ #endif @@ -1357,7 +1358,7 @@ GC_INNER void GC_stop_world(void) # if !defined(GC_NO_THREADS_DISCOVERY) || defined(GC_ASSERTIONS) GC_please_stop = TRUE; # endif -# if defined(MSWIN32) || defined(MSWINCE) +# if (defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE) GC_ASSERT(!GC_write_disabled); EnterCriticalSection(&GC_write_cs); /* It's not allowed to call GC_printf() (and friends) here down to */ @@ -1399,7 +1400,7 @@ GC_INNER void GC_stop_world(void) } } } -# if defined(MSWIN32) || defined(MSWINCE) +# if (defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE) # ifdef GC_ASSERTIONS GC_write_disabled = FALSE; # endif |