inline void
ev_run(event *e)
{
- e->hook(e->data);
- ev_postpone(e);
+ if (!e->hook(e->data))
+ ev_postpone(e);
}
inline void
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);
}
}
-
static char *p_states[] = { "DOWN", "START", "UP", "STOP" };
static char *c_states[] = { "HUNGRY", "FEEDING", "HAPPY", "FLUSHING" };
-static void proto_flush_all(void *);
+static int proto_flush_all(void *);
static void
proto_enqueue(list *l, struct proto *p)
proto_rethink_goal(p);
}
-static void
+static int
proto_feed(void *P)
{
struct proto *p = P;
p->core_state = FS_HAPPY;
proto_relink(p);
DBG("Protocol %s up and running\n", p->name);
+ return 0;
}
void
proto_relink(p);
}
-static void
+static int
proto_flush_all(void *unused)
{
struct proto *p;
proto_relink(p);
proto_fell_down(p);
}
+ return 0;
}