]> granicus.if.org Git - gc/commitdiff
Add assertion that thread is suspended when using context registers
authorIvan Maidanski <ivmai@mail.ru>
Mon, 16 Sep 2019 08:39:42 +0000 (11:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 16 Sep 2019 08:39:42 +0000 (11:39 +0300)
* 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.

win32_threads.c

index 3a44f56363ee87a0eb9e8873ac4dc868fd20ea84..bd1bbc86bbecf1e9bf352c330b4bb28e1c8d6e2d 100644 (file)
@@ -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");