summaryrefslogtreecommitdiffstats
path: root/lib/event.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-11-17 13:01:11 +0100
committerMartin Mares <mj@ucw.cz>1999-11-17 13:01:11 +0100
commit84a7d7f77c05578d9ebfff90672e73f021999d25 (patch)
tree30e57fa3bf32b130ae88faf51f30e1159a138ffa /lib/event.c
parentffb59d243a350ed525850e864b38af0ecb0ffea5 (diff)
downloadbird-84a7d7f77c05578d9ebfff90672e73f021999d25.tar
bird-84a7d7f77c05578d9ebfff90672e73f021999d25.zip
ev_run() now returns whether the event has been requeued or not.
ev_run_list() now returns number of events which remain in the list.
Diffstat (limited to 'lib/event.c')
-rw-r--r--lib/event.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/event.c b/lib/event.c
index e9ae3be..8f72a70 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -50,11 +50,13 @@ ev_new(pool *p)
return e;
}
-inline void
+inline int
ev_run(event *e)
{
- if (!e->hook(e->data))
+ int keep = e->hook(e->data);
+ if (!keep)
ev_postpone(e);
+ return keep;
}
inline void
@@ -71,14 +73,16 @@ ev_schedule(event *e)
ev_enqueue(&global_event_list, e);
}
-void
+int
ev_run_list(event_list *l)
{
node *n, *p;
+ int keep = 0;
WALK_LIST_DELSAFE(n, p, *l)
{
event *e = SKIP_BACK(event, n, n);
- ev_run(e);
+ keep += ev_run(e);
}
+ return keep;
}