summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-07-29 02:24:52 +0100
committerwm4 <wm4@nowhere>2016-07-30 00:02:39 +0200
commitc3e11f7b7c9aec22f7ecc56feacf42194e7ea727 (patch)
treec15fd7c3a37794796921d8bfbf709fe00c95901a /osdep
parentf3f4e048d8c08d4d578c85dbb32cc80314814d6f (diff)
downloadmpv-c3e11f7b7c9aec22f7ecc56feacf42194e7ea727.tar.bz2
mpv-c3e11f7b7c9aec22f7ecc56feacf42194e7ea727.tar.xz
osdep/io: introduce mp_flush_wakeup_pipe()
Makes a fairly common occurence with wakeup_pipes easier to handle.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/io.c8
-rw-r--r--osdep/io.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/osdep/io.c b/osdep/io.c
index 5952f21980..26889189cf 100644
--- a/osdep/io.c
+++ b/osdep/io.c
@@ -85,6 +85,14 @@ int mp_make_wakeup_pipe(int pipes[2])
}
#endif
+void mp_flush_wakeup_pipe(int pipe_end)
+{
+#ifndef __MINGW32__
+ char buf[100];
+ (void)read(pipe_end, buf, sizeof(buf));
+#endif
+}
+
#ifdef _WIN32
#include <windows.h>
diff --git a/osdep/io.h b/osdep/io.h
index 541e36aeea..333ed4f808 100644
--- a/osdep/io.h
+++ b/osdep/io.h
@@ -47,6 +47,7 @@
bool mp_set_cloexec(int fd);
int mp_make_cloexec_pipe(int pipes[2]);
int mp_make_wakeup_pipe(int pipes[2]);
+void mp_flush_wakeup_pipe(int pipe_end);
#ifdef _WIN32
#include <wchar.h>