1
0
mirror of https://github.com/zeromq/cppzmq.git synced 2025-04-02 09:49:45 +02:00

Problem: inconsistent error handling in poller_t

Solution: make poller_t::add and poller_t::remove throw error_t on error, return void
This commit is contained in:
sigiesec 2018-03-26 16:59:47 +02:00
parent 16a76513e3
commit 608613217e

12
zmq.hpp

@ -1013,22 +1013,22 @@ namespace zmq
return *this;
}
bool add (zmq::socket_t &socket, short events, std::function<void(void)> &handler)
void add (zmq::socket_t &socket, short events, std::function<void(void)> &handler)
{
if (0 == zmq_poller_add (poller_ptr, socket.ptr, handler ? &handler : NULL, events)) {
poller_events.emplace_back (zmq_poller_event_t ());
return true;
return;
}
return false;
throw error_t ();
}
bool remove (zmq::socket_t &socket)
void remove (zmq::socket_t &socket)
{
if (0 == zmq_poller_remove (poller_ptr, socket.ptr)) {
poller_events.pop_back ();
return true;
return;
}
return false;
throw error_t ();
}
bool wait (std::chrono::milliseconds timeout)