0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Allowing to send events to the metaloop's priority list

This commit is contained in:
Maria Matejka 2024-04-05 14:11:38 +02:00
parent b114aa0073
commit 422ecddaae
2 changed files with 13 additions and 0 deletions

View File

@ -29,6 +29,9 @@ void birdloop_free(struct birdloop *loop);
/* Get birdloop's event list */ /* Get birdloop's event list */
event_list *birdloop_event_list(struct birdloop *loop); 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 */ /* Get birdloop's time heap */
struct timeloop *birdloop_time_loop(struct birdloop *loop); struct timeloop *birdloop_time_loop(struct birdloop *loop);
#define birdloop_domain(l) (birdloop_time_loop((l))->domain) #define birdloop_domain(l) (birdloop_time_loop((l))->domain)

View File

@ -1396,6 +1396,7 @@ birdloop_init(void)
timers_init(&main_birdloop.time, &root_pool); timers_init(&main_birdloop.time, &root_pool);
birdloop_enter_locked(&main_birdloop); birdloop_enter_locked(&main_birdloop);
this_thread = &main_thread;
} }
static void static void
@ -1689,3 +1690,12 @@ birdloop_yield(void)
{ {
usleep(100); 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);
}