summaryrefslogtreecommitdiffstats
path: root/src/polyp/mainloop.c
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-05-11 11:08:58 +0000
committerPierre Ossman <ossman@cendio.se>2006-05-11 11:08:58 +0000
commit48d66cd5e89764b00fe225db4823b3392a759942 (patch)
tree0e60a5cf549d07f6be53e60fa83b355fd77a7094 /src/polyp/mainloop.c
parent12d4b5d952c7a284fd081966a02d34d94dd6be10 (diff)
Handle pipes on platforms where they are non-existant of broken.
We do this by creating a TCP socket pair instead of a normal pipe. Since Windows isn't UNIX-y enough to support read()/write() on sockets, we also need a wrapper to handle read() vs recv() and write() vs send(). git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@840 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/polyp/mainloop.c')
-rw-r--r--src/polyp/mainloop.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/polyp/mainloop.c b/src/polyp/mainloop.c
index 98b3f3c6..589fe77e 100644
--- a/src/polyp/mainloop.c
+++ b/src/polyp/mainloop.c
@@ -40,6 +40,10 @@
#include "../polypcore/winsock.h"
+#ifndef HAVE_PIPE
+#include "../polypcore/pipe.h"
+#endif
+
#include <polypcore/util.h>
#include <polypcore/idxset.h>
#include <polypcore/xmalloc.h>
@@ -330,18 +334,14 @@ pa_mainloop *pa_mainloop_new(void) {
m = pa_xmalloc(sizeof(pa_mainloop));
-#ifndef OS_IS_WIN32
if (pipe(m->wakeup_pipe) < 0) {
+ pa_log_error(__FILE__": ERROR: cannot create wakeup pipe");
pa_xfree(m);
return NULL;
}
pa_make_nonblock_fd(m->wakeup_pipe[0]);
pa_make_nonblock_fd(m->wakeup_pipe[1]);
-#else
- m->wakeup_pipe[0] = -1;
- m->wakeup_pipe[1] = -1;
-#endif
m->io_events = pa_idxset_new(NULL, NULL);
m->defer_events = pa_idxset_new(NULL, NULL);
@@ -622,7 +622,7 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
assert(m);
if (m->wakeup_pipe[1] >= 0)
- write(m->wakeup_pipe[1], &c, sizeof(c));
+ pa_write(m->wakeup_pipe[1], &c, sizeof(c));
}
static void clear_wakeup(pa_mainloop *m) {
@@ -633,7 +633,7 @@ static void clear_wakeup(pa_mainloop *m) {
if (m->wakeup_pipe[0] < 0)
return;
- while (read(m->wakeup_pipe[0], &c, sizeof(c)) == sizeof(c));
+ while (pa_read(m->wakeup_pipe[0], &c, sizeof(c)) == sizeof(c));
}
int pa_mainloop_prepare(pa_mainloop *m, int timeout) {