Class: Async::Scheduler::FiberInterrupt
- Inherits:
-
Object
- Object
- Async::Scheduler::FiberInterrupt
- Defined in:
- lib/async/scheduler.rb
Overview
Used to defer stopping the current task until later.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(fiber, exception) ⇒ FiberInterrupt
constructor
Create a new stop later operation.
-
#transfer ⇒ Object
Transfer control to the operation - this will stop the task.
Constructor Details
#initialize(fiber, exception) ⇒ FiberInterrupt
Create a new stop later operation.
381 382 383 384 |
# File 'lib/async/scheduler.rb', line 381 def initialize(fiber, exception) @fiber = fiber @exception = exception end |
Instance Method Details
#alive? ⇒ Boolean
387 388 389 |
# File 'lib/async/scheduler.rb', line 387 def alive? @fiber.alive? end |
#transfer ⇒ Object
Transfer control to the operation - this will stop the task.
392 393 394 395 |
# File 'lib/async/scheduler.rb', line 392 def transfer # Fiber.blocking{$stderr.puts "FiberInterrupt#transfer(#{@fiber}, #{@exception})"} @fiber.raise(@exception) end |