mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-01-06 08:41:15 +01:00
Merge pull request #227 from sigiesec/poller-wait-all-return-sizet
Problem: poller_t::wait_all and active_poller_t::wait declare int ret…
This commit is contained in:
commit
590cf711e5
6
zmq.hpp
6
zmq.hpp
@ -1091,14 +1091,14 @@ template <typename T = void> class poller_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wait_all (std::vector<zmq_poller_event_t> &poller_events,
|
size_t wait_all (std::vector<zmq_poller_event_t> &poller_events,
|
||||||
const std::chrono::microseconds timeout)
|
const std::chrono::microseconds timeout)
|
||||||
{
|
{
|
||||||
int rc = zmq_poller_wait_all (poller_ptr.get (), poller_events.data (),
|
int rc = zmq_poller_wait_all (poller_ptr.get (), poller_events.data (),
|
||||||
static_cast<int> (poller_events.size ()),
|
static_cast<int> (poller_events.size ()),
|
||||||
static_cast<long> (timeout.count ()));
|
static_cast<long> (timeout.count ()));
|
||||||
if (rc > 0)
|
if (rc > 0)
|
||||||
return rc;
|
return static_cast<size_t> (rc);
|
||||||
|
|
||||||
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3)
|
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3)
|
||||||
if (zmq_errno () == EAGAIN)
|
if (zmq_errno () == EAGAIN)
|
||||||
|
@ -398,7 +398,7 @@ class active_poller_t
|
|||||||
base_poller.modify (socket, events);
|
base_poller.modify (socket, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wait (std::chrono::milliseconds timeout)
|
size_t wait (std::chrono::milliseconds timeout)
|
||||||
{
|
{
|
||||||
if (need_rebuild) {
|
if (need_rebuild) {
|
||||||
poller_events.resize (handlers.size ());
|
poller_events.resize (handlers.size ());
|
||||||
@ -409,16 +409,13 @@ class active_poller_t
|
|||||||
}
|
}
|
||||||
need_rebuild = false;
|
need_rebuild = false;
|
||||||
}
|
}
|
||||||
const int count = base_poller.wait_all (poller_events, timeout);
|
const auto count = base_poller.wait_all (poller_events, timeout);
|
||||||
if (count != 0) {
|
std::for_each (poller_events.begin (), poller_events.begin () + count,
|
||||||
std::for_each (poller_events.begin (),
|
[](zmq_poller_event_t &event) {
|
||||||
poller_events.begin () + count,
|
if (event.user_data != NULL)
|
||||||
[](zmq_poller_event_t &event) {
|
(*reinterpret_cast<handler_t *> (
|
||||||
if (event.user_data != NULL)
|
event.user_data)) (event.events);
|
||||||
(*reinterpret_cast<handler_t *> (
|
});
|
||||||
event.user_data)) (event.events);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user