class Async::Task
def initialize(parent = Task.current?, finished: nil, **options, &block)
@parameter reactor [Reactor] the reactor this task will run within.
Create a new task.
def initialize(parent = Task.current?, finished: nil, **options, &block) super(parent, **options) # These instance variables are critical to the state of the task. # In the initialized state, the @block should be set, but the @fiber should be nil. # In the running state, the @fiber should be set. # In a finished state, the @block should be nil, and the @fiber should be nil. @block = block @fiber = nil @status = :initialized @result = nil @finished = finished @defer_stop = nil end