summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-04-12 09:57:34 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-04-12 09:57:34 +0200
commit7668e7976dc6c3e18a314d991381f29f5cbcc6ef (patch)
tree32e6834dd3d773497188a5636eef8be3c73e759b
parent3236cb1a54316206d14a0f925dfa79d5b35f70fc (diff)
zmq_poll returns ETERM in case of context termination
-rw-r--r--doc/zmq_socket.txt3
-rw-r--r--src/zmq.cpp11
2 files changed, 9 insertions, 5 deletions
diff --git a/doc/zmq_socket.txt b/doc/zmq_socket.txt
index a9dd528..8f10cc7 100644
--- a/doc/zmq_socket.txt
+++ b/doc/zmq_socket.txt
@@ -117,9 +117,6 @@ The requested socket 'type' is invalid.
The number of application threads using sockets within this 'context' has been
exceeded. See the 'app_threads' parameter of the _zmq_init()_ function.
-*ETERM*::
-The associated context was terminted.
-
SEE ALSO
--------
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 0681cbb..74d52f6 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -408,7 +408,11 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// Process 0MQ commands if needed.
if (nsockets && pollfds [npollfds -1].revents & POLLIN)
- app_thread->process_commands (false, false);
+ if (!app_thread->process_commands (false, false)) {
+ free (pollfds);
+ errno = ETERM;
+ return -1;
+ }
// Check for the events.
int pollfd_pos = 0;
@@ -560,7 +564,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// Process 0MQ commands if needed.
if (nsockets && FD_ISSET (notify_fd, &inset))
- app_thread->process_commands (false, false);
+ if (!app_thread->process_commands (false, false)) {
+ errno = ETERM;
+ return -1;
+ }
// Check for the events.
for (int i = 0; i != nitems_; i++) {