X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-sharp%2FClient.cs;h=02763d40d67be6357ef00355a39b22e1d13dcfe1;hb=af5704d57bc23aaa43bdd0cbee79f5cfeccde4b5;hp=40ca4119adc917d560913578c34d251aaab2223a;hpb=bd121fc9b9f6bdcd7074e4fb15b195ce0e491b5c;p=catta diff --git a/avahi-sharp/Client.cs b/avahi-sharp/Client.cs index 40ca411..02763d4 100644 --- a/avahi-sharp/Client.cs +++ b/avahi-sharp/Client.cs @@ -271,6 +271,7 @@ namespace Avahi throw new ClientException (error); thread = new Thread (PollLoop); + thread.IsBackground = true; thread.Start (); } @@ -287,9 +288,12 @@ namespace Avahi if (handle != IntPtr.Zero) { lock (this) { avahi_client_free (handle); + handle = IntPtr.Zero; + avahi_simple_poll_quit (spoll); + Monitor.Wait (this); + avahi_simple_poll_free (spoll); - handle = IntPtr.Zero; } } } @@ -371,6 +375,7 @@ namespace Avahi try { lock (this) { avahi_simple_poll_loop (spoll); + Monitor.Pulse (this); } } catch (Exception e) { Console.Error.WriteLine ("Error in avahi-sharp event loop: " + e);