Class: Nl::Async::Drivers::Fiber

Inherits:
Object
  • Object
show all
Defined in:
nl/lib/nl/async/driver.rb

Instance Method Summary collapse

Instance Method Details

#start(&block) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
# File 'nl/lib/nl/async/driver.rb', line 15

def start(&block)
  raise ArgumentError, 'Fiber.scheduler is not installed' unless ::Fiber.scheduler

  ::Fiber.schedule(&block)
end

#stop(_task) ⇒ Object



21
22
23
24
# File 'nl/lib/nl/async/driver.rb', line 21

def stop(_task)
  # Scheduled fibers have no general join operation. Closing the socket
  # makes the receive loop terminate at its next scheduling point.
end