From: Ivan Maidanski Date: Mon, 16 Sep 2019 08:39:42 +0000 (+0300) Subject: Add assertion that thread is suspended when using context registers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=190e18c75;p=gc Add assertion that thread is suspended when using context registers * win32_threads.c (GC_push_stack_for): Add assertion that thread is suspended (before using context registers) if thread is not self and not blocked. --- diff --git a/win32_threads.c b/win32_threads.c index 3a44f563..bd1bbc86 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1600,6 +1600,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) /* require looping. */ word *regs = thread->context_regs; + GC_ASSERT(thread->suspended); sp = thread->context_sp; # else /* For unblocked threads call GetThreadContext(). */ @@ -1607,6 +1608,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me) { CONTEXT context; + GC_ASSERT(thread->suspended); context.ContextFlags = GET_THREAD_CONTEXT_FLAGS; if (!GetThreadContext(THREAD_HANDLE(thread), &context)) ABORT("GetThreadContext failed");