Problem: tricky return value from zmq::socket_poller_t::wait when poller is empty
Solution: return -1 (no event) instead of 0 (event) For some reason, this just returns 0 if there are no sockets registered on the poller. Usually this would mean there has been an event. So the caller would have to check the return value AND the event, or write code that takes the number of registered sockets into consideration. By returning -1 and setting errno = ETIMEDOUT like in the usual timeout cases, it's more consistent and convenient. Test case included.
Showing
Please
register
or
sign in
to comment