uloop: add support for interval timers
[project/libubox.git] / uloop.c
diff --git a/uloop.c b/uloop.c
index 8fc5aee6743b4a86bbc1277ecdb1f7d90e219326..a3d37124be253713a535216f1c3abd18363d1db8 100644 (file)
--- a/uloop.c
+++ b/uloop.c
@@ -36,6 +36,7 @@
 #endif
 #ifdef USE_EPOLL
 #include <sys/epoll.h>
+#include <sys/timerfd.h>
 #endif
 #include <sys/wait.h>
 
@@ -422,6 +423,21 @@ static void uloop_handle_processes(void)
 
 }
 
+int uloop_interval_set(struct uloop_interval *timer, unsigned int msecs)
+{
+       return timer_register(timer, msecs);
+}
+
+int uloop_interval_cancel(struct uloop_interval *timer)
+{
+       return timer_remove(timer);
+}
+
+int64_t uloop_interval_remaining(struct uloop_interval *timer)
+{
+       return timer_next(timer);
+}
+
 static void uloop_signal_wake(void)
 {
        do {