diff options
| author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2025-12-06 21:44:14 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-06 21:44:14 +1300 |
| commit | 42f5654b69244b5892ff2c2eba8d838064d2cd9f (patch) | |
| tree | d06a50ab465ac36fe8b4ebacda7f13ab44556f46 /thread.c | |
| parent | 180020e1e53b96a3080f3ac731cb32bbbdee31d5 (diff) | |
Yield to scheduler if interrupts are pending. (#14700)
Diffstat (limited to 'thread.c')
| -rw-r--r-- | thread.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -221,7 +221,18 @@ vm_check_ints_blocking(rb_execution_context_t *ec) th->pending_interrupt_queue_checked = 0; RUBY_VM_SET_INTERRUPT(ec); } - return rb_threadptr_execute_interrupts(th, 1); + + int result = rb_threadptr_execute_interrupts(th, 1); + + // When a signal is received, we yield to the scheduler as soon as possible: + if (result || RUBY_VM_INTERRUPTED(ec)) { + VALUE scheduler = rb_fiber_scheduler_current(); + if (scheduler != Qnil) { + rb_fiber_scheduler_yield(scheduler); + } + } + + return result; } int |
