diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/event.c | 15 | ||||
-rw-r--r-- | lib/event.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/event.c b/lib/event.c index 962c640..e9ae3be 100644 --- a/lib/event.c +++ b/lib/event.c @@ -53,8 +53,8 @@ ev_new(pool *p) inline void ev_run(event *e) { - e->hook(e->data); - ev_postpone(e); + if (!e->hook(e->data)) + ev_postpone(e); } inline void @@ -74,14 +74,11 @@ ev_schedule(event *e) void ev_run_list(event_list *l) { - for(;;) + node *n, *p; + + WALK_LIST_DELSAFE(n, p, *l) { - node *n = HEAD(*l); - event *e; - if (!n->next) - break; - e = SKIP_BACK(event, n, n); + event *e = SKIP_BACK(event, n, n); ev_run(e); } } - diff --git a/lib/event.h b/lib/event.h index 0b1ea84..0856fbb 100644 --- a/lib/event.h +++ b/lib/event.h @@ -13,7 +13,7 @@ typedef struct event { resource r; - void (*hook)(void *); + int (*hook)(void *); void *data; node n; /* Internal link */ } event; |