mono/dbus-sharp — Issue #22: Add Connection.(Un)TrapSignals
Author: hyperair
Created: 2011-11-07 02:05:15+00:00
State: open

A TrapSignals and UntrapSignals is needed for the implementation of certain DBus protocols like Avahi, where signals can come in between getting an ObjectPath as the return value of a function call and connecting handlers to its signals. Example use-case, as found in Mono.Zeroconf:

DBusManager.Bus.TrapSignals ();

lock (this) {
if (resolver != null) {
throw new InvalidOperationException ("The service is already running a resolve operation");
}

ObjectPath path = DBusManager.Server.ServiceResolverNew (AvahiInterface, AvahiProtocol,
Name ?? String.Empty, RegType ?? String.Empty, ReplyDomain ?? String.Empty,
AvahiProtocol, LookupFlags.None);

resolver = DBusManager.GetObject (path);
}

resolver.Failure += OnResolveFailure;
resolver.Found += OnResolveFound;

DBusManager.Bus.UntrapSignals ();