Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method · added in Ruby 4.0

Fiber::Scheduler#fiber_interrupt

fiber_interrupt(target, exception)

Invoked by Ruby’s core methods to notify the scheduler that a blocked fiber should be interrupted with an exception. For IO operations, target is an operation-scoped proxy which responds to alive?, raise, and transfer. The scheduler should enqueue the target on its owning thread and use only those methods. transfer raises the interruption’s stored exception in the target. Once the operation completes, alive? returns false and raise has no effect, preventing a delayed exception from escaping into a later operation.

Ruby version changes

  1. 4.0
See also #fiber #io_close #close #io_pread also in 4.0