Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Add Connection.(Un)TrapSignals #22

Open
hyperair opened this issue Nov 7, 2011 · 1 comment
Open

Add Connection.(Un)TrapSignals #22

hyperair opened this issue Nov 7, 2011 · 1 comment

Comments

@hyperair
Copy link

hyperair commented Nov 7, 2011

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<IAvahiServiceResolver> (path);
        }

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

        DBusManager.Bus.UntrapSignals ();
@ghost
Copy link

ghost commented Dec 12, 2016

This solved me a lot of problems. It should be merged to master

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant