summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2010-09-20 16:55:46 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-09-20 16:55:46 +0200
commitf49b77eedcdacf9663050a20723ac964af7cdac0 (patch)
tree8a612ef3c0011e785ecb5e899c6e15c0cd63e189 /src
parent1abfc92d265bce4f60d63cd302319c451d2c451a (diff)
zmq_poll honours ZMQ_FORCE_POLL and ZMQ_FORCE_SELECT options
Diffstat (limited to 'src')
-rw-r--r--src/zmq.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index c30a6aa..7d9424f 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -365,13 +365,23 @@ int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_)
return (((zmq::socket_base_t*) s_)->recv (msg_, flags_));
}
-int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
-{
-#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
+#if defined ZMQ_FORCE_SELECT
+#define ZMQ_POLL_BASED_ON_SELECT
+#elif defined ZMQ_FORCE_POLL
+#define ZMQ_POLL_BASED_ON_POLL
+#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD
+#define ZMQ_POLL_BASED_ON_POLL
+#elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS
+#define ZMQ_POLL_BASED_ON_SELECT
+#endif
+
+int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
+{
+#if defined ZMQ_POLL_BASED_ON_POLL
if (!items_) {
errno = EFAULT;
@@ -480,7 +490,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
free (pollfds);
return nevents;
-#elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS
+#elif defined ZMQ_POLL_BASED_ON_SELECT
fd_set pollset_in;
FD_ZERO (&pollset_in);
@@ -620,6 +630,13 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#endif
}
+#if defined ZMQ_POLL_BASED_ON_SELECT
+#undef ZMQ_POLL_BASED_ON_SELECT
+#endif
+#if defined ZMQ_POLL_BASED_ON_POLL
+#undef ZMQ_POLL_BASED_ON_POLL
+#endif
+
int zmq_errno ()
{
return errno;