mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
mem: add method to clear pool
This commit is contained in:
parent
0b2e4a18ff
commit
ed9d4e5e80
2 changed files with 15 additions and 5 deletions
|
|
@ -155,19 +155,26 @@ struct pw_mempool *pw_mempool_new(struct pw_properties *props)
|
|||
return this;
|
||||
}
|
||||
|
||||
void pw_mempool_destroy(struct pw_mempool *pool)
|
||||
void pw_mempool_clear(struct pw_mempool *pool)
|
||||
{
|
||||
struct mempool *impl = SPA_CONTAINER_OF(pool, struct mempool, this);
|
||||
struct memblock *b;
|
||||
|
||||
spa_list_consume(b, &impl->blocks, link)
|
||||
pw_memblock_free(&b->this);
|
||||
}
|
||||
|
||||
void pw_mempool_destroy(struct pw_mempool *pool)
|
||||
{
|
||||
struct mempool *impl = SPA_CONTAINER_OF(pool, struct mempool, this);
|
||||
|
||||
pw_log_debug(NAME" %p: destroy", pool);
|
||||
|
||||
pw_mempool_emit_destroy(impl);
|
||||
|
||||
spa_list_remove(&impl->link);
|
||||
pw_mempool_clear(pool);
|
||||
|
||||
spa_list_consume(b, &impl->blocks, link)
|
||||
pw_memblock_free(&b->this);
|
||||
spa_list_remove(&impl->link);
|
||||
|
||||
pw_map_clear(&impl->map);
|
||||
if (pool->props)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@ void pw_mempool_add_listener(struct pw_mempool *pool,
|
|||
const struct pw_mempool_events *events,
|
||||
void *data);
|
||||
|
||||
/** Destroy a pool */
|
||||
/** Clear a pool */
|
||||
void pw_mempool_clear(struct pw_mempool *pool);
|
||||
|
||||
/** Clear and destroy a pool */
|
||||
void pw_mempool_destroy(struct pw_mempool *pool);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue