From c3e11f7b7c9aec22f7ecc56feacf42194e7ea727 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Fri, 29 Jul 2016 02:24:52 +0100 Subject: osdep/io: introduce mp_flush_wakeup_pipe() Makes a fairly common occurence with wakeup_pipes easier to handle. --- audio/out/push.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'audio/out') diff --git a/audio/out/push.c b/audio/out/push.c index ac87c62a96..bf5dde46b5 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -497,10 +497,8 @@ int ao_wait_poll(struct ao *ao, struct pollfd *fds, int num_fds, bool wakeup = false; if (p_fds[num_fds].revents & POLLIN) { wakeup = true; - // flush the wakeup pipe contents - might "drown" some wakeups, but - // that's ok for our use-case - char buf[100]; - (void)read(p->wakeup_pipe[0], buf, sizeof(buf)); + // might "drown" some wakeups, but that's ok for our use-case + mp_flush_wakeup_pipe(p->wakeup_pipe[0]); } return (r >= 0 || r == -EINTR) ? wakeup : -1; } -- cgit v1.2.3