summaryrefslogtreecommitdiffstats
path: root/avahi-sharp/Client.cs
diff options
context:
space:
mode:
Diffstat (limited to 'avahi-sharp/Client.cs')
-rw-r--r--avahi-sharp/Client.cs7
1 files changed, 6 insertions, 1 deletions
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);