]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Allowing to send events to the metaloop's priority list
authorMaria Matejka <mq@ucw.cz>
Fri, 5 Apr 2024 12:11:38 +0000 (14:11 +0200)
committerMaria Matejka <mq@ucw.cz>
Sat, 6 Apr 2024 16:28:43 +0000 (18:28 +0200)
lib/io-loop.h
sysdep/unix/io-loop.c

index 80cd2ea2c5c8308d29427525f2083943817e8aa7..33a09aa910c51235528af49f2d1730751a06f0f3 100644 (file)
@@ -29,6 +29,9 @@ void birdloop_free(struct birdloop *loop);
 /* Get birdloop's event list */
 event_list *birdloop_event_list(struct birdloop *loop);
 
+/* Run this event in this thread's priority event list */
+void ev_send_this_thread(event *e);
+
 /* Get birdloop's time heap */
 struct timeloop *birdloop_time_loop(struct birdloop *loop);
 #define birdloop_domain(l)  (birdloop_time_loop((l))->domain)
index 0a222ba029b9f4dec33116ce16e1e7df475678d7..4f3f20659b4f0980ac601a627d6ce065ef57175d 100644 (file)
@@ -1396,6 +1396,7 @@ birdloop_init(void)
   timers_init(&main_birdloop.time, &root_pool);
 
   birdloop_enter_locked(&main_birdloop);
+  this_thread = &main_thread;
 }
 
 static void
@@ -1689,3 +1690,12 @@ birdloop_yield(void)
 {
   usleep(100);
 }
+
+void
+ev_send_this_thread(event *e)
+{
+  if (this_thread == &main_thread)
+    ev_send_loop(&main_birdloop, e);
+  else
+    ev_send(&this_thread->priority_events, e);
+}