lib/dbus/export.rb in ruby-dbus-openplacos-0.6.2 vs lib/dbus/export.rb in ruby-dbus-openplacos-0.7.0
- old
+ new
@@ -40,10 +40,18 @@
self.intfs = (self.intfs || {}).merge({intf.name => intf})
end
# Dispatch a message _msg_ to call exported methods
def dispatch(msg)
+ if @service.threaded?
+ Thread.new { process_dispatch(msg)}
+ else
+ process_dispatch(msg)
+ end
+ end
+
+ def process_dispatch(msg)
case msg.message_type
when Message::METHOD_CALL
reply = nil
begin
if not self.intfs[msg.interface]
@@ -67,9 +75,10 @@
reply = ErrorMessage.from_exception(ex).reply_to(msg)
end
@service.bus.send(reply.marshall)
end
end
+
# Select (and create) the interface that the following defined methods
# belong to.
def self.dbus_interface(s)
@@intfs_mutex.synchronize do