diff options
author | Martin Mares <mj@ucw.cz> | 1999-10-29 12:08:49 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-10-29 12:08:49 +0000 |
commit | 0d70292d88276a9883ab8bc15b00e6a2e2fe4487 (patch) | |
tree | 19985b61964aacd88b239cefbea547cca85eccb9 /lib/event.c | |
parent | 92af6f309b9283482384bd9bbd0351cd71e3cf1d (diff) |
Events now return a value. If it's non-zero, the event is re-queued
for processing in next event cycle. This can be used to prevent background
actions (hint: user commands) from hogging the CPU for too long time.
Diffstat (limited to 'lib/event.c')
-rw-r--r-- | lib/event.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/event.c b/lib/event.c index 962c6409..e9ae3be7 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); } } - |