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:
David Herrmann committed 2012-05-19 12:26:55 +02:00
1 parent 6a0742465b
commit f10ca03eab
2 files changed
+24

No files matched your search

+21
View File
@@ -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);
+3
View File
@@ -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);