bool blocker;
/**
+ * are we currently calling this listener
+ */
+ bool calling;
+
+ /**
* condvar where active listeners wait
*/
condvar_t *condvar;
this->listener = listener;
this->blocker = blocker;
+ this->calling = FALSE;
this->condvar = condvar_create(CONDVAR_DEFAULT);
return this;
*/
static bool signal_cb(entry_t *entry, signal_data_t *data)
{
+ if (entry->calling)
+ { /* avoid recursive calls */
+ return FALSE;
+ }
+ entry->calling = TRUE;
if (!entry->listener->signal(entry->listener, data->signal, data->level,
data->thread, data->ike_sa, data->format, data->args))
{
{
entry_destroy(entry);
}
+ entry->calling = FALSE;
return TRUE;
}
+ entry->calling = FALSE;
return FALSE;
}
this->public.destroy = (void(*)(bus_t*)) destroy;
this->listeners = linked_list_create();
- this->mutex = mutex_create(MUTEX_DEFAULT);
+ this->mutex = mutex_create(MUTEX_RECURSIVE);
pthread_key_create(&this->thread_id, NULL);
pthread_key_create(&this->thread_sa, NULL);