Class: Thread

Inherits:
Object show all
Defined in:
lib/roby/support.rb

Instance Method Summary collapse

Instance Method Details

#process_eventsObject



73
74
75
76
77
78
79
80
# File 'lib/roby/support.rb', line 73

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
end

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



65
66
67
68
69
70
71
72
# File 'lib/roby/support.rb', line 65

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