mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 07:31:54 +00:00
Thread IO: a little bit faster RX repeat
This commit is contained in:
parent
f516d7cfe9
commit
661193cf98
@ -21,6 +21,7 @@ extern _Thread_local struct birdloop *this_birdloop;
|
|||||||
|
|
||||||
/* Check that the task has enough time to do a bit more */
|
/* Check that the task has enough time to do a bit more */
|
||||||
_Bool task_still_in_limit(void);
|
_Bool task_still_in_limit(void);
|
||||||
|
_Bool task_before_halftime(void);
|
||||||
|
|
||||||
#define MAYBE_DEFER_TASK(target, event, fmt, args...) do { \
|
#define MAYBE_DEFER_TASK(target, event, fmt, args...) do { \
|
||||||
if (!task_still_in_limit()) { \
|
if (!task_still_in_limit()) { \
|
||||||
|
@ -543,9 +543,14 @@ sockets_fire(struct birdloop *loop)
|
|||||||
|
|
||||||
if (rev & POLLIN)
|
if (rev & POLLIN)
|
||||||
/* Read just one packet and request repeat. */
|
/* Read just one packet and request repeat. */
|
||||||
if ((s == loop->sock_active) && s->rx_hook)
|
while ((s == loop->sock_active) && s->rx_hook)
|
||||||
if (sk_read(s, rev))
|
if (!task_before_halftime())
|
||||||
|
{
|
||||||
repeat++;
|
repeat++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (!sk_read(s, rev))
|
||||||
|
break;
|
||||||
|
|
||||||
if (s != loop->sock_active)
|
if (s != loop->sock_active)
|
||||||
continue;
|
continue;
|
||||||
@ -1356,6 +1361,11 @@ _Bool task_still_in_limit(void)
|
|||||||
return ns_now() < account_last + this_thread->max_loop_time_ns;
|
return ns_now() < account_last + this_thread->max_loop_time_ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Bool task_before_halftime(void)
|
||||||
|
{
|
||||||
|
return ns_now() < account_last + this_thread->max_loop_time_ns / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Birdloop
|
* Birdloop
|
||||||
|
Loading…
Reference in New Issue
Block a user