From d6a22032078bcb260eb2e0dd2ca36235c5251115 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 1 Oct 2007 16:39:04 +0000 Subject: Fix race condition between IO thread creation and pa_sink_put(). Move activation of rtpoll fds when we change the state INIT->IDLE. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1922 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-alsa-sink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/modules/module-alsa-sink.c') diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c index 0489fa87..bb78bca2 100644 --- a/src/modules/module-alsa-sink.c +++ b/src/modules/module-alsa-sink.c @@ -450,6 +450,11 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_IDLE: case PA_SINK_RUNNING: + if (u->sink->thread_info.state == PA_SINK_INIT) { + if (build_pollfd(u) < 0) + return -1; + } + if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { if (unsuspend(u) < 0) return -1; @@ -604,9 +609,6 @@ static void thread_func(void *userdata) { pa_thread_mq_install(&u->thread_mq); pa_rtpoll_install(u->rtpoll); - if (build_pollfd(u) < 0) - goto fail; - for (;;) { int ret; -- cgit