[runtime] Fix interruption deferring
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 15 Mar 2017 23:15:58 +0000 (01:15 +0200)
committerVlad Brezae <brezaevlad@gmail.com>
Mon, 20 Mar 2017 21:01:01 +0000 (23:01 +0200)
We were accidentally clearing the interruption deferred flag when exiting from nested abort protected regions.

mono/metadata/threads.c

index 6831de896320d1b723061a9924f7cc78b3e242ec..e31e0bbd4e8025165bb8cda75eb496aec531ba51 100644 (file)
@@ -282,8 +282,11 @@ mono_threads_end_abort_protected_block (void)
                int new_val = ((old_state & ABORT_PROT_BLOCK_MASK) >> ABORT_PROT_BLOCK_SHIFT) - 1;
                new_state = 0;
 
-               if ((old_state & INTERRUPT_REQUEST_DEFERRED_BIT) && new_val == 0) {
-                       new_state |= INTERRUPT_REQUESTED_BIT;
+               if (old_state & INTERRUPT_REQUEST_DEFERRED_BIT) {
+                       if (new_val == 0)
+                               new_state |= INTERRUPT_REQUESTED_BIT;
+                       else
+                               new_state |= INTERRUPT_REQUEST_DEFERRED_BIT;
                }
 
                //bounds check abort_prot_count