Work on async cleanup

Track all async changes and only perform free of resources when all
previous async operations completed.
This commit is contained in:
Wim Taymans 2016-11-25 13:06:23 +01:00
parent 7ecfc28d0f
commit 1d61fd3696
19 changed files with 270 additions and 130 deletions

View file

@ -54,6 +54,17 @@ pinos_port_new (PinosNode *node,
return this;
}
static void
sync_destroy (void *object,
void *data,
SpaResult res,
uint32_t id)
{
PinosPort *port = object;
free (port);
}
void
pinos_port_destroy (PinosPort *port)
{
@ -61,6 +72,8 @@ pinos_port_destroy (PinosPort *port)
pinos_signal_emit (&port->destroy_signal, port);
spa_list_remove (&port->link);
spa_node_port_use_buffers (port->node->node,
port->direction,
port->port_id,
@ -68,8 +81,11 @@ pinos_port_destroy (PinosPort *port)
port->buffers = NULL;
port->n_buffers = 0;
spa_list_remove (&port->link);
free (port);
pinos_main_loop_defer (port->node->core->main_loop,
port,
SPA_RESULT_WAIT_SYNC,
sync_destroy,
port);
}
static SpaResult