Fix undefined behaviour in pulseaudio --start.
authorStefan Sperling <stsp@openbsd.org>
Thu, 21 Nov 2013 17:47:42 +0000 (18:47 +0100)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Fri, 22 Nov 2013 15:31:11 +0000 (17:31 +0200)
commitd8e2b3a78c6c60ffec9a115a0e35a3cb4c68598f
treebe2de26e622f80c94b4bc3c15454f0453b4c0452
parent303cff04eb8c091fb0c7665440797fc56f07d570
Fix undefined behaviour in pulseaudio --start.

Don't call pthread_join() to join a thread from a different
process than the thread was created in. Doing so can lead to
undefined behaviour.

On OpenBSD, the symptom was a pulseaudio process with a single
thread waiting forever for other threads to join. Since that
process also held the autospawn lock, starting new pulseaudio
processes with --start kept failing. The problem was analyzed
with help from Philip Guenther.

This patch adds a pa_thread_free_nojoin() function which can
be used to free resources for a thread without a join, as
suggested by Tanu Kaskinen.

See https://bugs.freedesktop.org/show_bug.cgi?id=71738
src/pulsecore/lock-autospawn.c
src/pulsecore/thread-posix.c
src/pulsecore/thread.h