diff options
author | Felix Fietkau <nbd@nbd.name> | 2023-05-23 13:24:33 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2023-05-23 16:32:36 +0300 |
commit | 75a3b870cace1171faf57bd55e5a9a2f1564f757 (patch) | |
tree | 35c63732cdc5920269466c179258409d49c811d7 /uloop-kqueue.c | |
parent | 362951a2d96e5c00a2ca5f9495d18cf16f43bc68 (diff) |
uloop: add support for integrating with a different event loop
- support reading the next timeout in order to determine the poll timeout
- add a callback for fd add/delete/update
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'uloop-kqueue.c')
-rw-r--r-- | uloop-kqueue.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/uloop-kqueue.c b/uloop-kqueue.c index ba5595b..c1275b0 100644 --- a/uloop-kqueue.c +++ b/uloop-kqueue.c @@ -66,6 +66,9 @@ static int register_kevent(struct uloop_fd *fd, unsigned int flags) if (changed & ULOOP_EDGE_TRIGGER) changed |= flags; + if (!changed) + return 0; + if (changed & ULOOP_READ) { kflags = get_flags(flags, ULOOP_READ); EV_SET(&ev[nev++], fd->fd, EVFILT_READ, kflags, 0, 0, fd); @@ -79,7 +82,6 @@ static int register_kevent(struct uloop_fd *fd, unsigned int flags) if (!flags) fl |= EV_DELETE; - fd->flags = flags; if (kevent(poll_fd, ev, nev, NULL, fl, &timeout) == -1) return -1; |