summaryrefslogtreecommitdiffstats
path: root/polyp/mainloop.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-01-10 17:51:06 +0000
committerLennart Poettering <lennart@poettering.net>2006-01-10 17:51:06 +0000
commitf7a99e90470526bb28cc0c225f96490110094aed (patch)
treecbcc4f2df6d66e180fd65ee50488545786d094f1 /polyp/mainloop.c
parent80ae72ce45dbc23ddc360749924110dcc752491e (diff)
Merge Pierre's changes
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@445 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/mainloop.c')
-rw-r--r--polyp/mainloop.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/polyp/mainloop.c b/polyp/mainloop.c
index f6bb4145..ada74afc 100644
--- a/polyp/mainloop.c
+++ b/polyp/mainloop.c
@@ -26,13 +26,20 @@
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
-#include <sys/poll.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#else
+#include "poll.h"
+#endif
+
+#include "winsock.h"
+
#include "mainloop.h"
#include "util.h"
#include "idxset.h"
@@ -103,6 +110,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;
@@ -457,7 +484,7 @@ static int calc_next_timeout(struct pa_mainloop *m) {
/* Let's save a system call */
if (!got_time) {
- gettimeofday(&now, NULL);
+ pa_gettimeofday(&now);
got_time = 1;
}
@@ -498,7 +525,7 @@ static int dispatch_timeout(struct pa_mainloop *m) {
/* Let's save a system call */
if (!got_time) {
- gettimeofday(&now, NULL);
+ pa_gettimeofday(&now);
got_time = 1;
}