-
Notifications
You must be signed in to change notification settings - Fork 197
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
fix #204 #205 #207 #206
base: develop
Are you sure you want to change the base?
fix #204 #205 #207 #206
Changes from all commits
c6e3338
bd94d1f
ef37737
25bd507
b6632bf
23d979e
752ae10
886692a
a6dc243
b927055
36b83f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,10 @@ namespace zmqpp | |
* \param socket the socket to monitor. | ||
* \param callable the function that will be called by the loop when a registered event occurs on socket. | ||
* \param event the event flags to monitor on the socket. | ||
* \param after_remove_cb will be called by loop after remove() completion. | ||
* See tests/test_loop.cpp: socket_closed_in_timer and socket_closed_after_remove_at_timer | ||
*/ | ||
void add(socket_t& socket, Callable callable, short const event = poller::poll_in); | ||
void add(socket_t& socket, Callable callable, short const event = poller::poll_in, Callable after_remove_cb = Callable(nullptr)); | ||
|
||
/*! | ||
* Add a standard socket to the loop, providing a handler that will be called when the monitored events occur. | ||
|
@@ -113,6 +115,16 @@ namespace zmqpp | |
*/ | ||
void start(); | ||
|
||
|
||
/** | ||
* Get revents on a standard socket after poll(). | ||
* | ||
* \param descriptor the standard socket to stop monitoring. | ||
* Attention: it do a second search thru list of FDs | ||
*/ | ||
short events(raw_socket_t const descriptor) const; | ||
short events(socket const& socket) const; | ||
|
||
private: | ||
struct timer_t { | ||
size_t times; | ||
|
@@ -125,18 +137,18 @@ namespace zmqpp | |
void update(); | ||
}; | ||
|
||
typedef std::pair<zmq_pollitem_t, Callable> PollItemCallablePair; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does changing these types break api backward compatibility? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think no. it's private type. But size of class will be changed, so recompile of clients is required. bluca, please say me what is better:
First method is implemented now. But second seems more clean for user and more simple to implement. |
||
typedef std::tuple<zmq_pollitem_t, Callable, Callable> PollItemCallableTuple; | ||
typedef std::pair<std::unique_ptr<timer_t>, Callable> TimerItemCallablePair; | ||
static bool TimerItemCallablePairComp(const TimerItemCallablePair &lhs, const TimerItemCallablePair &rhs); | ||
|
||
std::vector<PollItemCallablePair> items_; | ||
std::vector<PollItemCallableTuple> items_; | ||
std::list<TimerItemCallablePair> timers_; | ||
std::vector<const socket_t *> sockRemoveLater_; | ||
std::vector<raw_socket_t> fdRemoveLater_; | ||
std::vector<timer_id_t> timerRemoveLater_; | ||
|
||
|
||
void add(const zmq_pollitem_t &item, Callable callable); | ||
void add(const zmq_pollitem_t &item, Callable callable, Callable after_remove_cb = Callable(nullptr)); | ||
void add(std::unique_ptr<timer_t>, Callable callable); | ||
|
||
bool start_handle_timers(); | ||
|
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.
will this break ABI?
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.
Yes. Method's name will be mangled differently. Clients of libzmqpp need to be recompiled. But no changes at source code of clients.