[pulseaudio-discuss] [PATCH] thread-mq: Make pa_thread_mq_done more robust

David Henningsson david.henningsson at canonical.com
Mon Mar 23 23:44:28 PDT 2015

On 2015-03-23 18:18, Tanu Kaskinen wrote:
> On Mon, 2015-03-23 at 14:39 +0100, David Henningsson wrote:
>> While investigating bug 89672 it was found that pa_thread_mq_done
>> was called recursively. Regardless of whether the recursion should
>> be stopped by other means, it seems to make sense to make
>> pa_thread_mq_done more robust so that it can be called twice
>> (and even recursively) without harm.
>> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89672
>> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
>> ---
>>   src/pulsecore/thread-mq.c | 32 +++++++++++++++++++++++---------
>>   1 file changed, 23 insertions(+), 9 deletions(-)
> I would prefer to replace pa_thread_mq_init() and pa_thread_mq_done()
> with pa_thread_mq_new() and pa_thread_mq_free(), the difference of
> course being that _new() would return a newly allocated struct instead
> of modifying a caller-supplied struct. That would allow the bluetooth
> code to set the thread_mq to NULL when it's not used.

In general, I don't mind that approach, but I wonder how well it would 
work in this recursion case - it seems like such an attempt would double 
free the thread_mq?

David Henningsson, Canonical Ltd.

More information about the pulseaudio-discuss mailing list