2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

use a thread-local variable to get the current running loop

if we had a method to get the running loop, similar to how
isc_tid() gets the current thread ID, we can simplify loop
and loopmgr initialization.

remove most uses of isc_loop_current() in favor of isc_loop().
in some places where that was the only reason to pass loopmgr,
remove loopmgr from the function parameters.
This commit is contained in:
Evan Hunt
2024-03-26 00:13:45 -07:00
committed by Ondřej Surý
parent cad6292fc4
commit c47fa689d4
22 changed files with 77 additions and 79 deletions

View File

@@ -424,14 +424,14 @@ timer_event(void *arg ISC_ATTR_UNUSED) {
if (--timer_ticks == 0) {
isc_timer_destroy(&timer);
isc_loopmgr_shutdown(loopmgr);
timer_stop = isc_loop_now(isc_loop_current(loopmgr));
timer_stop = isc_loop_now(isc_loop());
} else {
isc_timer_start(timer, timer_type, &timer_interval);
}
}
ISC_LOOP_SETUP_IMPL(reschedule_up) {
timer_start = isc_loop_now(isc_loop_current(loopmgr));
timer_start = isc_loop_now(isc_loop());
timer_expect = 1;
timer_ticks = 1;
timer_type = isc_timertype_once;
@@ -451,7 +451,7 @@ ISC_LOOP_TEST_CUSTOM_IMPL(reschedule_up, setup_loop_reschedule_up,
}
ISC_LOOP_SETUP_IMPL(reschedule_down) {
timer_start = isc_loop_now(isc_loop_current(loopmgr));
timer_start = isc_loop_now(isc_loop());
timer_expect = 0;
timer_ticks = 1;
timer_type = isc_timertype_once;
@@ -471,7 +471,7 @@ ISC_LOOP_TEST_CUSTOM_IMPL(reschedule_down, setup_loop_reschedule_down,
}
ISC_LOOP_SETUP_IMPL(reschedule_from_callback) {
timer_start = isc_loop_now(isc_loop_current(loopmgr));
timer_start = isc_loop_now(isc_loop());
timer_expect = 1;
timer_ticks = 2;
timer_type = isc_timertype_once;
@@ -487,7 +487,7 @@ ISC_LOOP_TEST_CUSTOM_IMPL(reschedule_from_callback,
}
ISC_LOOP_SETUP_IMPL(zero) {
timer_start = isc_loop_now(isc_loop_current(loopmgr));
timer_start = isc_loop_now(isc_loop());
timer_expect = 0;
timer_ticks = 1;
timer_type = isc_timertype_once;
@@ -502,7 +502,7 @@ ISC_LOOP_TEST_CUSTOM_IMPL(zero, setup_loop_zero, teardown_loop_timer_expect) {
}
ISC_LOOP_SETUP_IMPL(reschedule_ticker) {
timer_start = isc_loop_now(isc_loop_current(loopmgr));
timer_start = isc_loop_now(isc_loop());
timer_expect = 1;
timer_ticks = 5;
timer_type = isc_timertype_ticker;