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

@@ -1616,9 +1616,8 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result) {
isc_interval_t i;
isc_timer_create(
isc_loop_current(fctx->res->loopmgr),
spillattimer_countdown, fctx->res,
&fctx->res->spillattimer);
isc_loop(), spillattimer_countdown,
fctx->res, &fctx->res->spillattimer);
isc_interval_set(&i, 20 * 60, 0);
isc_timer_start(fctx->res->spillattimer,
@@ -10016,9 +10015,8 @@ dns_resolver_prime(dns_resolver_t *res) {
LOCK(&res->primelock);
result = dns_resolver_createfetch(
res, dns_rootname, dns_rdatatype_ns, NULL, NULL, NULL,
NULL, 0, DNS_FETCHOPT_NOFORWARD, 0, NULL,
isc_loop_current(res->loopmgr), prime_done, res,
rdataset, NULL, &res->primefetch);
NULL, 0, DNS_FETCHOPT_NOFORWARD, 0, NULL, isc_loop(),
prime_done, res, rdataset, NULL, &res->primefetch);
UNLOCK(&res->primelock);
if (result != ISC_R_SUCCESS) {