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.
This commit is contained in:
Martin Mares 2000-04-27 22:28:49 +00:00
parent 987de54578
commit 8f6accb5bb
6 changed files with 17 additions and 21 deletions

View file

@ -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

View file

@ -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);

View file

@ -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 *);

View file

@ -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

View file

@ -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;
}
/*

View file

@ -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