diff options
author | Martin Mares <mj@ucw.cz> | 2000-04-28 00:28:49 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-04-28 00:28:49 +0200 |
commit | 8f6accb5bb26d534576e086894c107387f67906a (patch) | |
tree | b7c02cbdaca870a6f86e0110d2b1d270f5c89d77 | |
parent | 987de54578ce4053d737c64ea924a32f46a441a7 (diff) | |
download | bird-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.
-rw-r--r-- | conf/conf.c | 3 | ||||
-rw-r--r-- | lib/event.c | 17 | ||||
-rw-r--r-- | lib/event.h | 4 | ||||
-rw-r--r-- | nest/locks.c | 3 | ||||
-rw-r--r-- | nest/proto.c | 8 | ||||
-rw-r--r-- | nest/rt-table.c | 3 |
6 files changed, 17 insertions, 21 deletions
diff --git a/conf/conf.c b/conf/conf.c index a4e0363..323655d 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -144,7 +144,7 @@ config_do_commit(struct config *c) return !nobs; } -static int +static void config_done(void *unused) { struct config *c; @@ -168,7 +168,6 @@ config_done(void *unused) if (!config_do_commit(c)) break; } - return 0; } int 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 *); diff --git a/nest/locks.c b/nest/locks.c index 0f43c56..d321fab 100644 --- a/nest/locks.c +++ b/nest/locks.c @@ -111,7 +111,7 @@ olock_acquire(struct object_lock *l) ev_schedule(olock_event); } -int +static void olock_run_event(void *unused) { node *n; @@ -132,7 +132,6 @@ olock_run_event(void *unused) add_tail(&olock_list, &q->n); q->hook(q); } - return 0; } void diff --git a/nest/proto.c b/nest/proto.c index f6eb32c..1af76ea 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -43,7 +43,7 @@ static event *proto_flush_event; static char *p_states[] = { "DOWN", "START", "UP", "STOP" }; static char *c_states[] = { "HUNGRY", "FEEDING", "HAPPY", "FLUSHING" }; -static int proto_flush_all(void *); +static void proto_flush_all(void *); static void proto_rethink_goal(struct proto *p); static char *proto_state_name(struct proto *p); @@ -399,7 +399,7 @@ proto_fell_down(struct proto *p) proto_rethink_goal(p); } -static int +static void proto_feed(void *P) { struct proto *p = P; @@ -411,7 +411,6 @@ proto_feed(void *P) p->core_state = FS_HAPPY; proto_relink(p); DBG("Protocol %s up and running\n", p->name); - return 0; } void @@ -469,7 +468,7 @@ proto_notify_state(struct proto *p, unsigned ps) proto_relink(p); } -static int +static void proto_flush_all(void *unused) { struct proto *p; @@ -485,7 +484,6 @@ proto_flush_all(void *unused) proto_relink(p); proto_fell_down(p); } - return 0; } /* diff --git a/nest/rt-table.c b/nest/rt-table.c index 6ad5b06..ae27ceb 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -466,7 +466,7 @@ rt_dump_all(void) rt_dump(t); } -static int +static void rt_gc(void *tab) { rtable *t = tab; @@ -474,7 +474,6 @@ rt_gc(void *tab) DBG("Entered routing table garbage collector for %s after %d seconds and %d deletes\n", t->name, (int)(now - t->gc_time), t->gc_counter); rt_prune(t); - return 0; } void |