summaryrefslogtreecommitdiffstats
path: root/polyp/mainloop.c
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-01-05 22:51:37 +0000
committerPierre Ossman <ossman@cendio.se>2006-01-05 22:51:37 +0000
commit19d9fcbda8637099854f2d8147b402b4420d19f5 (patch)
tree993f0ebc9045bd893cd3039d0ae6277ee5806c05 /polyp/mainloop.c
parent2f74bb9d437fc165695e1d4bb7516ca979962a49 (diff)
Port to Windows. This is mostly glue layers for the poor POSIX support
on Windows. A few notes * Only sockets behave somewhat like file descriptors in UNIX. * There are no fixed paths. Closes thing is environment variables that point to system directories. We also figure out where the binary/dll is located and use that as configuration directory. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@418 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/mainloop.c')
-rw-r--r--polyp/mainloop.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/polyp/mainloop.c b/polyp/mainloop.c
index 90243bdf..9cfd5397 100644
--- a/polyp/mainloop.c
+++ b/polyp/mainloop.c
@@ -38,6 +38,10 @@
#include "poll.h"
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#include "mainloop.h"
#include "util.h"
#include "idxset.h"
@@ -108,6 +112,26 @@ static struct pa_io_event* mainloop_io_new(struct pa_mainloop_api*a, int fd, enu
e->destroy_callback = NULL;
e->pollfd = NULL;
+#ifdef OS_IS_WIN32
+ {
+ fd_set xset;
+ struct timeval tv;
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+
+ FD_ZERO (&xset);
+ FD_SET (fd, &xset);
+
+ if ((select((SELECT_TYPE_ARG1) fd, NULL, NULL, SELECT_TYPE_ARG234 &xset,
+ SELECT_TYPE_ARG5 &tv) == -1) &&
+ (WSAGetLastError() == WSAENOTSOCK)) {
+ pa_log_warn(__FILE__": WARNING: cannot monitor non-socket file descriptors.\n");
+ e->dead = 1;
+ }
+ }
+#endif
+
pa_idxset_put(m->io_events, e, NULL);
m->rebuild_pollfds = 1;
return e;