From b31b2cc2cb0273388288d96f3fc21132b43ea2f6 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 9 Dec 2022 08:35:19 +0300 Subject: Fix 'GC_write called with write_disabled' assertion in GC_suspend (fix of commit bc1866b14) Reproduced only if DEBUG_THREADS is defined. Do not call GC_log_printf(), even indirectly from GC_stop_world() with GC_write_cs acquired. * pthread_support.c [DEBUG_THREADS] (GC_delete_thread, GC_delete_gc_thread_no_free): Do not call GC_log_printf() if MSWINCE or MSWIN32 and not CONSOLE_LOG. * win32_threads.c [DEBUG_THREADS] (GC_suspend): Likewise. --- pthread_support.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pthread_support.c') diff --git a/pthread_support.c b/pthread_support.c index 1c51e6b1..7d758346 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -742,7 +742,8 @@ GC_INNER_WIN32THREAD void GC_delete_thread(thread_id_t id) GC_thread p; GC_thread prev = NULL; -# ifdef DEBUG_THREADS +# if defined(DEBUG_THREADS) && !defined(MSWINCE) \ + && (!defined(MSWIN32) || defined(CONSOLE_LOG)) GC_log_printf("Deleting thread %p, n_threads= %d\n", (void *)(signed_word)id, GC_count_threads()); # endif @@ -826,7 +827,8 @@ GC_INNER_WIN32THREAD void GC_delete_thread(thread_id_t id) # ifdef GC_DARWIN_THREADS mach_port_deallocate(mach_task_self(), p -> mach_thread); # endif -# ifdef DEBUG_THREADS +# if defined(DEBUG_THREADS) && !defined(MSWINCE) \ + && (!defined(MSWIN32) || defined(CONSOLE_LOG)) GC_log_printf("Deleted thread %p, n_threads= %d\n", (void *)(signed_word)id, GC_count_threads()); # endif -- cgit v1.2.1