This can be useful for cleanup with pending timers, or for hooking into
existing code that does not use uloop
Signed-off-by: Felix Fietkau <nbd@nbd.name>
return uloop_run_depth > 0 && uloop_cancelled;
}
-int uloop_run(void)
+int uloop_run_timeout(int timeout)
{
+ int next_time = 0;
struct timeval tv;
/*
break;
uloop_gettime(&tv);
- uloop_run_events(uloop_get_next_timeout(&tv));
+
+ next_time = uloop_get_next_timeout(&tv);
+ if (timeout > 0 && next_time < timeout)
+ timeout = next_time;
+ uloop_run_events(timeout);
}
if (!--uloop_run_depth)
}
int uloop_init(void);
-int uloop_run(void);
+int uloop_run_timeout(int timeout);
+static inline int uloop_run(void)
+{
+ return uloop_run_timeout(-1);
+}
void uloop_done(void);
#endif