]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ev_run() now returns whether the event has been requeued or not.
authorMartin Mares <mj@ucw.cz>
Wed, 17 Nov 1999 12:01:11 +0000 (12:01 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 17 Nov 1999 12:01:11 +0000 (12:01 +0000)
ev_run_list() now returns number of events which remain in the list.

lib/event.c
lib/event.h

index e9ae3be76f19676a43080f104eb45dbff987c58b..8f72a70cf2b7bb51372c4d94f8c10cf69517df72 100644 (file)
@@ -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;
 }
index 0856fbb0990330f874e557296b64d7c195491677..32a9a3fad3891bd9922d0be17d1b2dda41e1a4b3 100644 (file)
@@ -23,11 +23,11 @@ typedef list event_list;
 extern event_list global_event_list;
 
 event *ev_new(pool *);
-void ev_run(event *);
+int ev_run(event *);
 #define ev_init_list(el) init_list(el)
 void ev_enqueue(event_list *, event *);
 void ev_schedule(event *);
 void ev_postpone(event *);
-void ev_run_list(event_list *);
+int ev_run_list(event_list *);
 
 #endif