[pulseaudio-discuss] [PATCH v0 01/16] sink, source: Fix missing pa_asyncmsgq_ref()
Tanu Kaskinen
tanuk at iki.fi
Sun Sep 30 00:55:17 PDT 2012
On Fri, 2012-09-28 at 17:45 +0200, Mikel Astiz wrote:
> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
>
> Sinks and sources hold a pointer to asyncmsgq, so they should use the
> reference counting mechanism to make sure this queue is not freed.
I don't really want to apply this. This shouldn't be needed, so if this
makes some bug unreproducible, it's a case of hiding a programming
error, not really fixing it.
Explanation why this shouldn't be needed:
The pa_sink.asyncmsgq variable should only be used by the main thread,
and only when the sink is linked. pa_sink.asyncmsgq always points to
pa_thread_mq's inq. pa_thread_mq.inq is created in pa_thread_mq_init()
and unreffed in pa_thread_mq_done(). pa_thread_mq_done() is only called
after the "hardware sink" (the one implementing the IO thread) has been
unlinked. Therefore, at least the hardware sink is fine without any
extra pa_asyncmsgq_ref() calls. What about filter sinks then? Can they
be linked while the hardware sink is not, therefore maybe allowing the
filter sink's asyncmsgq to be used while the underlying pa_thread_mq is
gone? No. The filter sinks are unlinked at the same time when the
hardware sink is unlinked. So, pa_sink.asyncmsgq will always have a
reference when it's needed. No need to call pa_asyncmsgq_ref() in
pa_sink_set_asyncmsgq().
--
Tanu
More information about the pulseaudio-discuss
mailing list