allow to have listening state TRUE while sending singal ourself
authorMartin Willi <martin@strongswan.org>
Thu, 3 May 2007 14:22:15 +0000 (14:22 -0000)
committerMartin Willi <martin@strongswan.org>
Thu, 3 May 2007 14:22:15 +0000 (14:22 -0000)
src/charon/bus/bus.c

index 740663d..dfbb899 100644 (file)
@@ -315,6 +315,13 @@ static void vsignal(private_bus_t *this, signal_t signal, level_t level,
        iterator = this->active_listeners->create_iterator(this->active_listeners, TRUE);
        while (iterator->iterate(iterator, (void**)&active_listener))
        {
+               /* if the thread raising the signal is the same as the one that
+                * listens, we skip it. Otherwise we have a deadlock */
+               if (active_listener->id == pthread_self())
+               {
+                       continue;
+               }
+       
                /* wait until it is back */
                while (active_listener->state == REGISTERED)
                {