Class: Thread

Inherits:
Object show all
Includes:
Roby::DRoby::Identifiable
Defined in:
lib/roby/support.rb

Instance Method Summary collapse

Methods included from Roby::DRoby::Identifiable

#droby_id, #initialize_copy

Instance Method Details

#process_eventsObject



91
92
93
94
95
96
97
98
# File 'lib/roby/support.rb', line 91

def process_events
    @msg_queue ||= Queue.new
    loop do
        object, name, args, block = *@msg_queue.deq(true)
        object.send(name, *args, &block)
    end
rescue ThreadError # rubocop:disable Lint/HandleExceptions
end

#send_to(object, name, *args, &prc) ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/roby/support.rb', line 82

def send_to(object, name, *args, &prc)
    if Thread.current == self
        object.send(name, *args, &prc)
    else
        @msg_queue ||= Queue.new
        @msg_queue << [object, name, args, prc]
    end
end