eloop: allow enabling/disabling counter sources
Similar to fd and timer sources we now also support disabling counter sources via similar functions. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
1 parent
6a0742465b
commit
f10ca03eab
2 files changed
+24
No files matched your search
+21
@@ -1034,6 +1034,27 @@ void ev_counter_unref(struct ev_counter *cnt)
|
||||
free(cnt);
|
||||
}
|
||||
|
||||
int ev_counter_enable(struct ev_counter *cnt)
|
||||
{
|
||||
if (!cnt)
|
||||
return -EINVAL;
|
||||
|
||||
return ev_fd_enable(cnt->efd);
|
||||
}
|
||||
|
||||
void ev_counter_disable(struct ev_counter *cnt)
|
||||
{
|
||||
if (!cnt)
|
||||
return;
|
||||
|
||||
ev_fd_disable(cnt->efd);
|
||||
}
|
||||
|
||||
bool ev_counter_is_enabled(struct ev_counter *cnt)
|
||||
{
|
||||
return cnt && ev_fd_is_enabled(cnt->efd);
|
||||
}
|
||||
|
||||
bool ev_counter_is_bound(struct ev_counter *cnt)
|
||||
{
|
||||
return cnt && ev_fd_is_bound(cnt->efd);
|
||||
|
||||
@@ -120,6 +120,9 @@ int ev_counter_new(struct ev_counter **out, ev_counter_cb, void *data);
|
||||
void ev_counter_ref(struct ev_counter *cnt);
|
||||
void ev_counter_unref(struct ev_counter *cnt);
|
||||
|
||||
int ev_counter_enable(struct ev_counter *cnt);
|
||||
void ev_counter_disable(struct ev_counter *cnt);
|
||||
bool ev_counter_is_enabled(struct ev_counter *cnt);
|
||||
bool ev_counter_is_bound(struct ev_counter *cnt);
|
||||
void ev_counter_set_cb_data(struct ev_counter *cnt, ev_counter_cb cb,
|
||||
void *data);
|
||||
|
||||
Reference in new issue
Block a user