mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-13 10:04:41 +00:00
Refactor, leverage internal API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
ce4f8d6ef5
commit
704d7d5612
2 files changed
+6
-6
No files matched your search
@@ -61,7 +61,7 @@ int uev_io_init(uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int fd, int e
|
||||
int uev_io_set(uev_t *w, int fd, int events)
|
||||
{
|
||||
|
||||
if ((events & UEV_ONESHOT) && w->active)
|
||||
if ((events & UEV_ONESHOT) && _uev_watcher_active(w))
|
||||
return _uev_watcher_rearm(w);
|
||||
|
||||
/* Ignore any errors, only to clean up anything lingering ... */
|
||||
|
||||
@@ -85,7 +85,7 @@ int _uev_watcher_start(uev_t *w)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (w->active)
|
||||
if (_uev_watcher_active(w))
|
||||
return 0;
|
||||
|
||||
ev.events = w->events | EPOLLRDHUP;
|
||||
@@ -109,7 +109,7 @@ int _uev_watcher_stop(uev_t *w)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!w->active)
|
||||
if (!_uev_watcher_active(w))
|
||||
return 0;
|
||||
|
||||
w->active = 0;
|
||||
@@ -130,7 +130,7 @@ int _uev_watcher_active(uev_t *w)
|
||||
if (!w)
|
||||
return 0;
|
||||
|
||||
return w->active;
|
||||
return w->active > 0;
|
||||
}
|
||||
|
||||
/* Private to libuEv, do not use directly! */
|
||||
@@ -189,7 +189,7 @@ int uev_exit(uev_ctx_t *ctx)
|
||||
/* Remove from internal list */
|
||||
LIST_REMOVE(w, link);
|
||||
|
||||
if (!w->active)
|
||||
if (!_uev_watcher_active(w))
|
||||
continue;
|
||||
|
||||
switch (w->type) {
|
||||
@@ -290,7 +290,7 @@ int uev_run(uev_ctx_t *ctx, int flags)
|
||||
|
||||
/* Restart watchers in new efd */
|
||||
LIST_FOREACH_SAFE(w, &ctx->watchers, link, tmp) {
|
||||
if (w->active) {
|
||||
if (_uev_watcher_active(w)) {
|
||||
w->active = 0;
|
||||
LIST_REMOVE(w, link);
|
||||
_uev_watcher_start(w);
|
||||
|
||||
Reference in new issue
Block a user