-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: poller's handler not aware of event type. #200
Conversation
It was possible to register a handler for more than one event types but impossible to distinguish which event is being handled. Now events are passed to a handler. Besides that some other changes: * new test covering changes in the poller * modified existing tests to cover changes in the poller * defined handler_t in poller_t scope for more convinient use and simpler code * helper loopback binder to be re-used in tests
Issue #199 It seems that with GCC on Linux <array> is implicitly included by one of stl includes already in zmq.hpp but it breaks on Windows with Visual Studio. Adding explicit include for array. Can not verify right now but this change is a good practice so creating a pull request.
void add (zmq::socket_t &socket, short events, std::function<void(void)> &handler) | ||
using handler_t = std::function<void(short)>; | ||
|
||
void add (zmq::socket_t &socket, short events, handler_t &handler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in a backwards-compatible way, i.e. keep a function with the old signature that wraps a std:: function<void(void)> and passes it to the function with the new signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for review. this is draft so no need for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Since it is related to a libzmq draft api, it can be regarded draft in cppzmq as well.
It was possible to register a handler for more than one event types but
impossible to distinguish which event is being handled.
Now events are passed to a handler.
Besides that some other changes:
and simpler code