summaryrefslogtreecommitdiffstats
path: root/src/modules/module-pipe-sink.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/module-pipe-sink.c')
-rw-r--r--src/modules/module-pipe-sink.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 9594a685..a1bdc8fb 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -126,8 +126,8 @@ static void thread_func(void *userdata) {
pa_rtpoll_install(u->rtpoll);
for (;;) {
- int ret;
struct pollfd *pollfd;
+ int ret;
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
@@ -170,36 +170,26 @@ static void thread_func(void *userdata) {
}
}
- /* Now give the sink inputs some to time to process their data */
- if ((ret = pa_sink_process_inputs(u->sink)) < 0)
- goto fail;
- if (ret > 0)
- continue;
-
- /* Check whether there is a message for us to process */
- if ((ret = pa_thread_mq_process(&u->thread_mq) < 0))
- goto finish;
- if (ret > 0)
- continue;
-
/* Hmm, nothing to do. Let's sleep */
pollfd->events = u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0;
- if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
- pa_log("poll() failed: %s", pa_cstrerror(errno));
+ if ((ret = pa_rtpoll_run(u->rtpoll, 1)) < 0)
goto fail;
- }
+
+ if (ret == 0)
+ goto finish;
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
+
if (pollfd->revents & ~POLLOUT) {
pa_log("FIFO shutdown.");
goto fail;
}
- }
+ }
fail:
- /* We have to continue processing messages until we receive the
- * SHUTDOWN message */
+ /* If this was no regular exit from the loop we have to continue
+ * processing messages until we received PA_MESSAGE_SHUTDOWN */
pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_MESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);