mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-13 13:29:58 -05:00
pulsecore: Reference count mempools
In future commits, server-wide SHMs will be replaced with per-client ones that will be dynamically created and freed according to clients connections open and close. Meanwhile, current PA design does not guarantee that the per-client mempool blocks are referenced only by client-specific objects. Thus reference count the pools and let each memblock inside the pool itself, or just attached to it, increment the pool's refcount upon allocation. This way, per-client mempools will only be freed when no further component in the system holds any references to its blocks. DiscussionLink: https://goo.gl/qesVMV Suggested-by: Tanu Kaskinen <tanuk@iki.fi> Suggested-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
This commit is contained in:
parent
1f5e72264e
commit
9bda6e344a
17 changed files with 84 additions and 20 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include "memchunk.h"
|
||||
|
||||
pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
|
||||
pa_mempool *pool;
|
||||
pa_memblock *n;
|
||||
size_t l;
|
||||
void *tdata, *sdata;
|
||||
|
|
@ -46,7 +47,9 @@ pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
|
|||
|
||||
l = PA_MAX(c->length, min);
|
||||
|
||||
n = pa_memblock_new(pa_memblock_get_pool(c->memblock), l);
|
||||
pool = pa_memblock_get_pool(c->memblock);
|
||||
n = pa_memblock_new(pool, l);
|
||||
pa_mempool_unref(pool), pool = NULL;
|
||||
|
||||
sdata = pa_memblock_acquire(c->memblock);
|
||||
tdata = pa_memblock_acquire(n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue