Method: Async::Scheduler#io_write
- Defined in:
- lib/async/scheduler.rb
#io_write(io, buffer, length, offset = 0) ⇒ Object
Write the specified buffer to the IO.
363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/async/scheduler.rb', line 363 def io_write(io, buffer, length, offset = 0) fiber = Fiber.current if timeout = io.timeout timer = @timers.after(timeout) do fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become writable!") end end @selector.io_write(fiber, io, buffer, length, offset) ensure timer&.cancel! end |