summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-28 00:28:49 +0200
committerMartin Mares <mj@ucw.cz>2000-04-28 00:28:49 +0200
commit8f6accb5bb26d534576e086894c107387f67906a (patch)
treeb7c02cbdaca870a6f86e0110d2b1d270f5c89d77 /lib
parent987de54578ce4053d737c64ea924a32f46a441a7 (diff)
downloadbird-8f6accb5bb26d534576e086894c107387f67906a.tar
bird-8f6accb5bb26d534576e086894c107387f67906a.zip
Event handlers no longer return re-queue flag. Instead of using it, just
call ev_schedule() on the same handler which should work perfectly now.
Diffstat (limited to 'lib')
-rw-r--r--lib/event.c17
-rw-r--r--lib/event.h4
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/event.c b/lib/event.c
index 9ac80ac..1f418d2 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -50,20 +50,17 @@ ev_new(pool *p)
return e;
}
-inline int
+inline void
ev_run(event *e)
{
- int keep = e->hook(e->data);
- if (!keep)
- ev_postpone(e);
- return keep;
+ ev_postpone(e);
+ e->hook(e->data);
}
inline void
ev_enqueue(event_list *l, event *e)
{
- if (e->n.next)
- rem_node(&e->n);
+ ev_postpone(e);
add_tail(l, &e->n);
}
@@ -77,8 +74,12 @@ int
ev_run_list(event_list *l)
{
node *n, *p;
+ list tmp_list;
- WALK_LIST_DELSAFE(n, p, *l)
+ init_list(&tmp_list);
+ add_tail_list(&tmp_list, l);
+ init_list(l);
+ WALK_LIST_DELSAFE(n, p, tmp_list)
{
event *e = SKIP_BACK(event, n, n);
ev_run(e);
diff --git a/lib/event.h b/lib/event.h
index 32a9a3f..d850041 100644
--- a/lib/event.h
+++ b/lib/event.h
@@ -13,7 +13,7 @@
typedef struct event {
resource r;
- int (*hook)(void *);
+ void (*hook)(void *);
void *data;
node n; /* Internal link */
} event;
@@ -23,7 +23,7 @@ typedef list event_list;
extern event_list global_event_list;
event *ev_new(pool *);
-int ev_run(event *);
+void ev_run(event *);
#define ev_init_list(el) init_list(el)
void ev_enqueue(event_list *, event *);
void ev_schedule(event *);