summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zmq.cpp')
-rw-r--r--src/zmq.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 736f764..9a4bdec 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -409,17 +409,12 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
while (true) {
- // Wait for events. Ignore interrupts if there's infinite timeout.
+ // Wait for events.
while (true) {
int rc = poll (pollfds, nitems_, first_pass ? 0 : timeout);
if (rc == -1 && errno == EINTR) {
- if (timeout_ < 0)
- continue;
- else {
- // TODO: Calculate remaining timeout and restart poll ().
- free (pollfds);
- return 0;
- }
+ free (pollfds);
+ return -1;
}
errno_assert (rc >= 0);
break;
@@ -474,6 +469,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (timeout == -1 && nevents == 0)
continue;
+ // TODO: if nevents is zero recompute timeout and loop
+ // if it is not yet reached.
+
break;
}
@@ -544,13 +542,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#if defined ZMQ_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
- if (rc == -1 && errno == EINTR) {
- if (timeout_ < 0)
- continue;
- else
- // TODO: Calculate remaining timeout and restart select ().
- return 0;
- }
+ if (rc == -1 && errno == EINTR)
+ return -1;
errno_assert (rc >= 0);
#endif
break;
@@ -610,6 +603,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (timeout_ < 0 && nevents == 0)
continue;
+ // TODO: if nevents is zero recompute timeout and loop
+ // if it is not yet reached.
+
break;
}