summaryrefslogtreecommitdiff
path: root/src/devpoll.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-11-02 14:27:24 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-11-02 14:27:24 +0100
commitd4a41067d3e873ba4a87c4711ad2f755e7de9157 (patch)
tree61c64f8209f6515efd62ac973c1125d8931e8a6c /src/devpoll.cpp
parentde93f6359f061d08846cd203ad3ba4fda915e504 (diff)
HP-UX has no OPEN_MAX defined
devpoll_t used this constant to determine how many events to retrieve from the poller in one go. The implementation was changed not to depend on this constant. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/devpoll.cpp')
-rw-r--r--src/devpoll.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/devpoll.cpp b/src/devpoll.cpp
index 67fed84..3cddecc 100644
--- a/src/devpoll.cpp
+++ b/src/devpoll.cpp
@@ -136,10 +136,6 @@ void zmq::devpoll_t::stop ()
void zmq::devpoll_t::loop ()
{
- // According to the poll(7d) man page, we can retrieve
- // no more then (OPEN_MAX - 1) events.
- int nfds = std::min ((int) max_io_events, OPEN_MAX - 1);
-
while (!stopping) {
struct pollfd ev_buf [max_io_events];
@@ -153,8 +149,13 @@ void zmq::devpoll_t::loop ()
int timeout = (int) execute_timers ();
// Wait for events.
+ // On Solaris, we can retrieve no more then (OPEN_MAX - 1) events.
poll_req.dp_fds = &ev_buf [0];
- poll_req.dp_nfds = nfds;
+#if defined ZMQ_HAVE_SOLRIS
+ poll_req.dp_nfds = std::min ((int) max_io_events, OPEN_MAX - 1);
+#else
+ poll_req.dp_nfds = max_io_events;
+#endif
poll_req.dp_timeout = timeout ? timeout : -1;
int n = ioctl (devpoll_fd, DP_POLL, &poll_req);
if (n == -1 && errno == EINTR)