Problem: duplicated socket_poller::wait() code

zmq::socket_poller_t::wait() had an important set of common lines
between POLL and SELECT variant.

Solution: refactor zmq::socket_poller_t::wait() and add the
following methods:

zmq::socket_poller_t::zero_trail_events()
zmq::socket_poller_t::check_events()
zmq::socket_poller_t::adjust_timeout()

Signed-off-by: Marc Sune <mardevel@gmail.com>
This commit is contained in:
Marc Sune
2017-09-07 00:11:22 +02:00
committed by Marc Sune
parent a89d79aa71
commit 5b92989540
2 changed files with 158 additions and 168 deletions

View File

@@ -81,6 +81,21 @@ namespace zmq
bool check_tag ();
private:
void zero_trail_events (zmq::socket_poller_t::event_t *events_,
int n_events_,
int found);
#if defined ZMQ_POLL_BASED_ON_POLL
int check_events (zmq::socket_poller_t::event_t *events_,
int n_events_);
#elif defined ZMQ_POLL_BASED_ON_SELECT
int check_events (zmq::socket_poller_t::event_t *events_, int n_events_,
fd_set& inset,
fd_set& outset,
fd_set& errset);
#endif
int adjust_timeout (zmq::clock_t& clock, long timeout_, uint64_t& now,
uint64_t& end,
bool& first_pass);
void rebuild ();
// Used to check whether the object is a socket_poller.