Implement subscription with a signal

Use a signal for subscription events
Work on handling OOM errors and other errors.
This commit is contained in:
Wim Taymans 2016-12-22 16:50:01 +01:00
parent 1b66bbcffd
commit 85d375e4bb
32 changed files with 531 additions and 176 deletions

View file

@ -97,6 +97,8 @@ main_loop_defer (PinosMainLoop *loop,
spa_list_remove (&item->link);
} else {
item = malloc (sizeof (WorkItem));
if (item == NULL)
return SPA_ID_INVALID;
}
item->id = ++impl->counter;
item->obj = obj;
@ -189,10 +191,15 @@ pinos_main_loop_new (void)
PinosMainLoop *this;
impl = calloc (1, sizeof (PinosMainLoopImpl));
if (impl == NULL)
return NULL;
pinos_log_debug ("main-loop %p: new", impl);
this = &impl->this;
this->loop = pinos_loop_new ();
if (this->loop == NULL)
goto no_loop;
pinos_signal_init (&this->destroy_signal);
@ -208,6 +215,10 @@ pinos_main_loop_new (void)
spa_list_init (&impl->free_list);
return this;
no_loop:
free (impl);
return NULL;
}
void