summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Willcox <snopr@snorp.net>2006-05-08 02:27:25 +0000
committerJames Willcox <snopr@snorp.net>2006-05-08 02:27:25 +0000
commit94412d25bf00b1300da97f819c5a85d057f07b94 (patch)
treefd756535d19fa2aaa193f80f4c27b847121a0e78
parentbd121fc9b9f6bdcd7074e4fb15b195ce0e491b5c (diff)
* make the event loop background again
* ensure the event loop is finished before freeing the poll object * set Client.Handle to null immediately after freeing it git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1216 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-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);