zeromq / cppzmq

Header-only C++ binding for libzmq
http://www.zeromq.org
MIT License
1.94k stars 757 forks source link

Deprecation of `poll(std::vector<zmq_pollitem_t> &items)` #494

Closed yuyichao closed 3 years ago

yuyichao commented 3 years ago

In https://github.com/zeromq/cppzmq/pull/415 (https://github.com/zeromq/cppzmq/pull/415/commits/b0e72439bdefe1a427cb626a0fc09bb4091471f2) poll(std::vector<zmq_pollitem_t> &items, long timeout_) is deprecated. I think this is fine but it also cause a deprecation warning if no timeout is given.

Is this deprecation intentional? If so, what will be the new way of specifying no timeout? It seems that the way to do it right now is either to call poll(zmq_pollitem_t *items_, size_t nitems_, long timeout_ = -1) (or zmq_poll) manually, or to pass an exactly -1ms timeout. Both of these solutions feels very wrong.

If this deprecation isn't intentional, a separate function poll(std::vector<zmq_pollitem_t> &items) should be added to suppress the warning.

gummif commented 3 years ago

Yes this is unfortunate. The timeout parameters should probably have a default value of milliseconds{-1}, and change the long timeout version to not have a default value.

gummif commented 3 years ago

See https://github.com/zeromq/cppzmq/pull/497 for proposed change