Skip to content

Commit aa7406d

Browse files
committed
Allow checking interrupts when VM lock held
It was too restrictive to disallow this case, because we can raise a ruby error while holding the VM lock, which calls initialize on the error object, which can enter the interrupt checks. So intead, we just don't switch to another thread if the VM lock is held.
1 parent 1fa307d commit aa7406d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

thread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,6 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing)
25962596
int ret = FALSE;
25972597

25982598
VM_ASSERT(GET_THREAD() == th);
2599-
ASSERT_vm_unlocking();
26002599

26012600
if (th->ec->raised_flag) return ret;
26022601

@@ -2677,7 +2676,7 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing)
26772676
rb_threadptr_to_kill(th);
26782677
}
26792678

2680-
if (timer_interrupt) {
2679+
if (timer_interrupt && th->vm->ractor.sync.lock_owner != th->ractor) {
26812680
uint32_t limits_us = thread_default_quantum_ms * 1000;
26822681

26832682
if (th->priority > 0)

0 commit comments

Comments
 (0)