class Roby::Coordination::Script::PollUntil

Attributes

block[R]
event[R]
root_task[R]

Public Class Methods

new(root_task, event, block) click to toggle source
# File lib/roby/coordination/script.rb, line 42
def initialize(root_task, event, block)
    @root_task, @event, @block = root_task, event, block
end

Public Instance Methods

cancel() click to toggle source
Calls superclass method
# File lib/roby/coordination/script.rb, line 46
def cancel
    if @poll_handler_id
        root_task.remove_poll_handler(@poll_handler_id)
    end
    super
end
execute(script) click to toggle source
# File lib/roby/coordination/script.rb, line 53
def execute(script)
    @poll_handler_id = root_task.poll do
        root_task.instance_eval(&block)
    end
    event = self.event.resolve
    event.on do |ev|
        if ev.generator == self.event.resolve && !disabled?
            cancel
            script.step
        end
    end

    if event.task != script.root_task
        script.root_task.depends_on event.task, success: event.symbol
    else
        event.when_unreachable(true) do |reason, generator|
            if !disabled?
                raise Script::DeadInstruction.new(script.root_task), "the 'until' condition of #{self} will never be reached: #{reason}"
            end
        end
    end

    false
end