summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/poll.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-11-23 00:12:18 +0100
committerDaniel Mack <daniel@caiaq.de>2009-12-16 16:11:36 +0800
commit17d34462eace417075efa2314999a77e41a3849b (patch)
tree55bc1bbf154797026d7dcd42762b7b12eac16cf9 /src/pulsecore/poll.c
parent962164a3b7f17f8a981862d7913a420636241a41 (diff)
poll() is totally broken on Mac OS X
Even on 10.5.8, poll() does not do the right thing. Haven't checked on newer versions. Hence, wrap all occurences of poll() to pa_poll and emulate that call with select() on OSX. This is totally embarassing.
Diffstat (limited to 'src/pulsecore/poll.c')
-rw-r--r--src/pulsecore/poll.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c
index 46a69c5f..1dcace8b 100644
--- a/src/pulsecore/poll.c
+++ b/src/pulsecore/poll.c
@@ -43,13 +43,18 @@
#include "winsock.h"
-#ifndef HAVE_POLL_H
-
#include <pulsecore/core-util.h>
+#include <pulse/util.h>
#include "poll.h"
-int poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
+/* Mac OSX fails to implement poll() in a working way since 10.4. IOW, for
+ * several years. We need to enable a dirty workaround and emulate that call
+ * with select(), just like for Windows. sic! */
+
+#if !defined(HAVE_POLL_H) || defined(OS_IS_DARWIN)
+
+int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
struct timeval tv;
fd_set rset, wset, xset;
struct pollfd *f;