summaryrefslogtreecommitdiff
path: root/src/dged/reactor-kqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dged/reactor-kqueue.c')
-rw-r--r--src/dged/reactor-kqueue.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dged/reactor-kqueue.c b/src/dged/reactor-kqueue.c
index d370653..c48e2aa 100644
--- a/src/dged/reactor-kqueue.c
+++ b/src/dged/reactor-kqueue.c
@@ -34,8 +34,14 @@ void reactor_destroy(struct reactor *reactor) {
free(reactor);
}
-void reactor_update(struct reactor *reactor) {
- int events = kevent(reactor->queue, NULL, 0, reactor->events, 16, NULL);
+void reactor_update(struct reactor *reactor, int timeout_ms) {
+ struct timespec timeout = {0};
+ if (timeout_ms >= 0) {
+ timeout.tv_nsec = timeout_ms * 1e6;
+ }
+
+ int events = kevent(reactor->queue, NULL, 0, reactor->events, 16,
+ timeout_ms >= 0 ? &timeout : NULL);
if (events == -1) {
// TODO: what to do here?
return;