[pulseaudio-discuss] [PATCH] alsa-sink/source: Better thread names

Tanu Kaskinen tanuk at iki.fi
Sat Dec 15 01:43:11 PST 2012


On Fri, 2012-12-14 at 16:03 +0100, David Henningsson wrote:
> @@ -2341,10 +2342,13 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
>  
>      pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
>  
> -    if (!(u->thread = pa_thread_new("alsa-sink", thread_func, u))) {
> +    thread_name = pa_sprintf_malloc("alsa-sink-%s", pa_strnull(pa_proplist_gets(u->sink->proplist, "alsa.id")));
> +    if (!(u->thread = pa_thread_new(thread_name, thread_func, u))) {
>          pa_log("Failed to create thread.");
>          goto fail;
>      }
> +    pa_xfree(thread_name);
> +    thread_name = NULL;
>  
>      /* Get initial mixer settings */
>      if (data.volume_is_set) {
> @@ -2389,6 +2393,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
>      return u->sink;
>  
>  fail:
> +    pa_xfree(thread_name);

Wouldn't it be better to put this pa_xfree() call inside the if block,
so that all thread_name handling would be visible at one place?

-- 
Tanu



More information about the pulseaudio-discuss mailing list