Commit a2af3d18 authored by Simon Giesecke's avatar Simon Giesecke

Problem: unittest_poller fails for poll_t

Solution: fixed behaviour in corner cases
parent ac777bad
...@@ -52,6 +52,7 @@ zmq::poll_t::poll_t (const zmq::ctx_t &ctx_) : ...@@ -52,6 +52,7 @@ zmq::poll_t::poll_t (const zmq::ctx_t &ctx_) :
zmq::poll_t::~poll_t () zmq::poll_t::~poll_t ()
{ {
stop ();
worker.stop (); worker.stop ();
} }
...@@ -141,6 +142,11 @@ void zmq::poll_t::loop () ...@@ -141,6 +142,11 @@ void zmq::poll_t::loop ()
// Execute any due timers. // Execute any due timers.
int timeout = (int) execute_timers (); int timeout = (int) execute_timers ();
if (pollset.empty ()) {
// TODO yield? or sleep for timeout?
continue;
}
// Wait for events. // Wait for events.
int rc = poll (&pollset[0], pollset.size (), timeout ? timeout : -1); int rc = poll (&pollset[0], pollset.size (), timeout ? timeout : -1);
if (rc == -1) { if (rc == -1) {
......
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