Class: Async::Scheduler::FiberInterrupt

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

Overview

Used to defer stopping the current task until later.

Instance Method Summary collapse

Constructor Details

#initialize(fiber, exception) ⇒ FiberInterrupt

Create a new stop later operation.



384
385
386
387
# File 'lib/async/scheduler.rb', line 384

def initialize(fiber, exception)
	@fiber = fiber
	@exception = exception
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


390
391
392
# File 'lib/async/scheduler.rb', line 390

def alive?
	@fiber.alive?
end

#transferObject

Transfer control to the operation - this will stop the task.



395
396
397
398
# File 'lib/async/scheduler.rb', line 395

def transfer
	# Fiber.blocking{$stderr.puts "FiberInterrupt#transfer(#{@fiber}, #{@exception})"}
	@fiber.raise(@exception)
end