Commit f49b77ee authored by Martin Lucina's avatar Martin Lucina Committed by Martin Sustrik

zmq_poll honours ZMQ_FORCE_POLL and ZMQ_FORCE_SELECT options

parent 1abfc92d
...@@ -365,13 +365,23 @@ int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_) ...@@ -365,13 +365,23 @@ int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_)
return (((zmq::socket_base_t*) s_)->recv (msg_, flags_)); return (((zmq::socket_base_t*) s_)->recv (msg_, flags_));
} }
int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) #if defined ZMQ_FORCE_SELECT
{ #define ZMQ_POLL_BASED_ON_SELECT
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ #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_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\ defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
defined ZMQ_HAVE_NETBSD 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_) { if (!items_) {
errno = EFAULT; errno = EFAULT;
...@@ -480,7 +490,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -480,7 +490,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
free (pollfds); free (pollfds);
return nevents; return nevents;
#elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS #elif defined ZMQ_POLL_BASED_ON_SELECT
fd_set pollset_in; fd_set pollset_in;
FD_ZERO (&pollset_in); FD_ZERO (&pollset_in);
...@@ -620,6 +630,13 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -620,6 +630,13 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#endif #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 () int zmq_errno ()
{ {
return errno; return errno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment