aboutsummaryrefslogtreecommitdiffstats
path: root/src/event_pipe.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-03 13:22:55 +0100
committerMax Kellermann <max@duempel.org>2009-01-03 13:22:55 +0100
commitfa9b5fd10b19bc651f4c52555764a9cd4c2c7de1 (patch)
tree253a77f6d45e32bc5cb0e191d0f0bcf3bbfb29da /src/event_pipe.c
parent4e0973a8f79c6b69b17d7f9c068f4ac64aa99cfa (diff)
downloadmpd-fa9b5fd10b19bc651f4c52555764a9cd4c2c7de1.tar.gz
mpd-fa9b5fd10b19bc651f4c52555764a9cd4c2c7de1.tar.xz
mpd-fa9b5fd10b19bc651f4c52555764a9cd4c2c7de1.zip
event_pipe: use _pipe() on WIN32
Windows has no pipe(), it only has _pipe() with two additional parameters.
Diffstat (limited to 'src/event_pipe.c')
-rw-r--r--src/event_pipe.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/event_pipe.c b/src/event_pipe.c
index 6398e9bbb..6fa89616f 100644
--- a/src/event_pipe.c
+++ b/src/event_pipe.c
@@ -26,6 +26,11 @@
#include <glib.h>
#include <string.h>
+#ifdef WIN32
+/* for _O_BINARY */
+#include <fcntl.h>
+#endif
+
static int event_pipe[2];
static GMutex *event_pipe_mutex;
static bool pipe_events[PIPE_EVENT_MAX];
@@ -76,8 +81,14 @@ main_notify_event(G_GNUC_UNUSED GIOChannel *source,
void event_pipe_init(void)
{
GIOChannel *channel;
-
- if (pipe(event_pipe) < 0)
+ int ret;
+
+#ifdef WIN32
+ ret = _pipe(event_pipe, 512, _O_BINARY);
+#else
+ ret = pipe(event_pipe);
+#endif
+ if (ret < 0)
g_error("Couldn't open pipe: %s", strerror(errno));
if (set_nonblocking(event_pipe[1]) < 0)
g_error("Couldn't set non-blocking I/O: %s", strerror(errno));