• Patrik Wenger's avatar
    Problem: tricky return value from zmq::socket_poller_t::wait when poller is empty · 621c965f
    Patrik Wenger authored
    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.
    621c965f
test_poller.cpp 4.8 KB