Quoting Andreas Rheinhardt (2023-09-19 21:57:16) > To do this, make FFRefStructPool itself refcounted according > to the RefStruct API. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > --- > libavcodec/refstruct.c | 29 ++++++++++++++++------------- > libavcodec/refstruct.h | 5 ++++- > 2 files changed, 20 insertions(+), 14 deletions(-) > > diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c > index f8d040874d..2108ff8163 100644 > --- a/libavcodec/refstruct.c > +++ b/libavcodec/refstruct.c > @@ -187,7 +187,7 @@ static void pool_free(FFRefStructPool *pool) > pthread_mutex_destroy(&pool->mutex); > if (pool->free_cb) > pool->free_cb(pool->opaque); > - av_free(pool); > + av_free(get_refcount(pool)); > } > > static void pool_free_entry(FFRefStructPool *pool, RefCount *ref) > @@ -278,13 +278,17 @@ void *ff_refstruct_pool_get(FFRefStructPool *pool) > return ret; > } > > -void ff_refstruct_pool_uninit(FFRefStructPool **poolp) > +static void pool_unref(void *ref) > { > - FFRefStructPool *pool = *poolp; > - RefCount *entry; > + FFRefStructPool *pool = get_userdata(ref); > + if (atomic_fetch_sub_explicit(&pool->refcount, 1, memory_order_acq_rel) > == 1)
Is there a reason you cannot fold pool->refcount into the pool's containing RefStruct? -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".