From 0d0c9486e3fe26fdd67624ee57961ba2d5846ebb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 23 Oct 2005 15:55:25 +0000 Subject: [PATCH] reorder locking git-svn-id: file:///home/lennart/svn/public/avahi/trunk@844 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-compat-libdns_sd/compat.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index 0306c2f..9fbe731 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -64,7 +64,7 @@ struct _DNSServiceRef_t { int thread_running; pthread_mutex_t mutex; - + void *context; DNSServiceBrowseReply service_browser_callback; DNSServiceResolveReply service_resolver_callback; @@ -336,7 +336,6 @@ static void sdref_free(DNSServiceRef sdref) { if (sdref->simple_poll) avahi_simple_poll_free(sdref->simple_poll); - if (sdref->thread_fd >= 0) close(sdref->thread_fd); @@ -388,9 +387,9 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) { AVAHI_WARN_LINKAGE; - sdref_ref(sdref); - ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex)); + + sdref_ref(sdref); /* Cleanup notification socket */ if (read_command(sdref->main_fd) != COMMAND_POLL_DONE) @@ -415,9 +414,9 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) { finish: - ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex)); - sdref_unref(sdref); + + ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex)); return ret; } -- 2.7.4