summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-09 08:35:19 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-12-09 16:36:07 +0300
commitb31b2cc2cb0273388288d96f3fc21132b43ea2f6 (patch)
treeffa66052dc55959ad172c600d39cdb3e26caeff8
parentf77d0654663a345ee440ef775b7fb935c103ced5 (diff)
downloadbdwgc-b31b2cc2cb0273388288d96f3fc21132b43ea2f6.tar.gz
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.
-rw-r--r--pthread_support.c6
-rw-r--r--win32_threads.c3
2 files changed, 6 insertions, 3 deletions
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
diff --git a/win32_threads.c b/win32_threads.c
index 4ff7c9cb..c60a2592 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -396,7 +396,8 @@ STATIC void GC_suspend(GC_thread t)
# endif
# endif
-# ifdef DEBUG_THREADS
+# if defined(DEBUG_THREADS) && !defined(MSWINCE) \
+ && (!defined(MSWIN32) || defined(CONSOLE_LOG))
GC_log_printf("Suspending 0x%x\n", (int)t->id);
# endif
GC_win32_unprotect_thread(t);