mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-03 12:38:25 +00:00
cron: New API for absolute timers
This patch adds support for at/cron-like jobs that need an absolute timer. The API supports waking up with an UEV_HUP callback event if the wall clock changed due to NTP or user input while waiting. - uev_cron_init() - uev_cron_set() - uev_cron_start() - uev_cron_stop() A very simple cronrun example/test program is also included. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
52d8d7109b
commit
59e1d376db
9 files changed
+301
-15
No files matched your search
@@ -31,13 +31,14 @@
|
||||
|
||||
/* I/O, timer, or signal watcher */
|
||||
typedef enum {
|
||||
UEV_IO_TYPE = 1,
|
||||
UEV_TIMER_TYPE,
|
||||
UEV_CRON_TYPE = 1,
|
||||
UEV_IO_TYPE,
|
||||
UEV_SIGNAL_TYPE,
|
||||
UEV_TIMER_TYPE,
|
||||
} uev_type_t;
|
||||
|
||||
/* Event mask, used internally only. */
|
||||
#define UEV_EVENT_MASK (UEV_READ | UEV_WRITE | UEV_PRI)
|
||||
#define UEV_EVENT_MASK (UEV_READ | UEV_WRITE | UEV_PRI | UEV_HUP)
|
||||
|
||||
/* Main libuEv context type */
|
||||
typedef struct {
|
||||
@@ -63,6 +64,12 @@ struct uev;
|
||||
\
|
||||
/* Arguments for different watchers */ \
|
||||
union { \
|
||||
/* Cron watchers */ \
|
||||
struct { \
|
||||
time_t when; \
|
||||
time_t interval; \
|
||||
} c; \
|
||||
\
|
||||
/* Timer watchers, time in milliseconds */ \
|
||||
struct { \
|
||||
int timeout; \
|
||||
|
||||
Reference in new issue
Block a user