Skip to content
instance method · added in Ruby 3.4

Fiber::Scheduler#blocking_operation_wait

blocking_operation_wait(blocking_operation)

Invoked by Ruby’s core methods to run a blocking operation in a non-blocking way. The blocking_operation is an opaque object that encapsulates the blocking operation and responds to a call method without any arguments.

If the scheduler doesn’t implement this method, or if the scheduler doesn’t execute the blocking operation, Ruby will fall back to the non-scheduler implementation.

Minimal suggested implementation is:

Example
def blocking_operation_wait(blocking_operation)
  Thread.new { blocking_operation.call }.join
end

Ruby version changes

  1. 3.4
See also #block #close #address_resolve #fiber also in 4.1 · 3.4