]> git.meshlink.io Git - catta/commitdiff
* add a seperate mutex for salt_lock()/salt_unlock() so that it doesn't interfere...
authorLennart Poettering <lennart@poettering.net>
Sun, 16 Oct 2005 14:26:53 +0000 (14:26 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 16 Oct 2005 14:26:53 +0000 (14:26 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@788 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-compat-howl/compat.c

index 120f81baaa6dcd0af97db7b9789e6b0297725132..d9a1bdab113792d4ea23bfc12aef3c51070ceb04 100644 (file)
@@ -88,7 +88,7 @@ struct _sw_discovery {
     pthread_t thread;
     int thread_running;
 
-    pthread_mutex_t mutex;
+    pthread_mutex_t mutex, salt_mutex;
 
     AVAHI_LLIST_HEAD(service_data, services);
 };
@@ -370,6 +370,7 @@ sw_result sw_discovery_init(sw_discovery * self) {
     ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
     pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
     ASSERT_SUCCESS(pthread_mutex_init(&(*self)->mutex, &mutex_attr));
+    ASSERT_SUCCESS(pthread_mutex_init(&(*self)->salt_mutex, &mutex_attr));
 
     if (!((*self)->simple_poll = avahi_simple_poll_new()))
         goto fail;
@@ -451,6 +452,7 @@ static void discovery_unref(sw_discovery self) {
         close(self->main_fd);
 
     ASSERT_SUCCESS(pthread_mutex_destroy(&self->mutex));
+    ASSERT_SUCCESS(pthread_mutex_destroy(&self->salt_mutex));
 
     while (self->services)
         service_data_free(self, self->services);
@@ -610,7 +612,7 @@ sw_result sw_salt_lock(sw_salt self) {
     AVAHI_WARN_LINKAGE;
 
     assert(self);
-    ASSERT_SUCCESS(pthread_mutex_lock(&((sw_discovery) self)->mutex));
+    ASSERT_SUCCESS(pthread_mutex_lock(&((sw_discovery) self)->salt_mutex));
 
     return SW_OKAY;
 }
@@ -620,7 +622,7 @@ sw_result sw_salt_unlock(sw_salt self) {
     
     AVAHI_WARN_LINKAGE;
 
-    ASSERT_SUCCESS(pthread_mutex_unlock(&((sw_discovery) self)->mutex));
+    ASSERT_SUCCESS(pthread_mutex_unlock(&((sw_discovery) self)->salt_mutex));
 
     return SW_OKAY;
 }