From c47fa689d47f1a387bef001e738ca47d95e21485 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 26 Mar 2024 00:13:45 -0700 Subject: [PATCH] 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. --- bin/delv/delv.c | 9 ++++----- bin/named/server.c | 11 +++++------ lib/dns/adb.c | 10 +++------- lib/dns/catz.c | 2 +- lib/dns/client.c | 11 +++++------ lib/dns/include/dns/adb.h | 9 +++------ lib/dns/include/dns/view.h | 5 ++--- lib/dns/include/dns/zone.h | 3 +-- lib/dns/nta.c | 2 +- lib/dns/resolver.c | 10 ++++------ lib/dns/rpz.c | 2 +- lib/dns/view.c | 8 ++++---- lib/dns/zone.c | 7 +++---- lib/isc/include/isc/loop.h | 10 ++++++++++ lib/isc/loop.c | 8 +++++++- lib/isc/timer.c | 9 ++++----- tests/bench/qpmulti.c | 9 ++++----- tests/dns/zonemgr_test.c | 8 ++++---- tests/isc/async_test.c | 2 +- tests/isc/job_test.c | 7 +++---- tests/isc/timer_test.c | 12 ++++++------ tests/libtest/dns.c | 2 +- 22 files changed, 77 insertions(+), 79 deletions(-) diff --git a/bin/delv/delv.c b/bin/delv/delv.c index c3b2d1c6f2..31d44667e9 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -2103,9 +2103,8 @@ sendquery(void *arg) { dns_view_attach(view, &(dns_view_t *){ NULL }); CHECK(dns_request_create(requestmgr, message, NULL, &peer, NULL, NULL, - DNS_REQUESTOPT_TCP, NULL, 1, 0, 0, - isc_loop_current(loopmgr), recvresponse, - message, &request)); + DNS_REQUESTOPT_TCP, NULL, 1, 0, 0, isc_loop(), + recvresponse, message, &request)); return; cleanup: @@ -2167,8 +2166,8 @@ run_server(void *arg) { dns_view_initsecroots(view); CHECK(setup_dnsseckeys(NULL, view)); - CHECK(dns_view_createresolver(view, loopmgr, netmgr, 0, - tlsctx_client_cache, dispatch, NULL)); + CHECK(dns_view_createresolver(view, netmgr, 0, tlsctx_client_cache, + dispatch, NULL)); isc_stats_create(mctx, &resstats, dns_resstatscounter_max); dns_resolver_setstats(view->resolver, resstats); diff --git a/bin/named/server.c b/bin/named/server.c index 04116bb365..a0f8741aa5 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -4701,9 +4701,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, goto cleanup; } - CHECK(dns_view_createresolver( - view, named_g_loopmgr, named_g_netmgr, resopts, - named_g_server->tlsctx_client_cache, dispatch4, dispatch6)); + CHECK(dns_view_createresolver(view, named_g_netmgr, resopts, + named_g_server->tlsctx_client_cache, + dispatch4, dispatch6)); if (resstats == NULL) { isc_stats_create(mctx, &resstats, dns_resstatscounter_max); @@ -8187,7 +8187,7 @@ load_configuration(const char *filename, named_server_t *server, /* * Require the reconfiguration to happen always on the main loop */ - REQUIRE(isc_loop_current(named_g_loopmgr) == named_g_mainloop); + REQUIRE(isc_loop() == named_g_mainloop); ISC_LIST_INIT(kasplist); ISC_LIST_INIT(keystorelist); @@ -9838,8 +9838,7 @@ run_server(void *arg) { named_server_t *server = (named_server_t *)arg; dns_geoip_databases_t *geoip = NULL; - dns_zonemgr_create(named_g_mctx, named_g_loopmgr, named_g_netmgr, - &server->zonemgr); + dns_zonemgr_create(named_g_mctx, named_g_netmgr, &server->zonemgr); CHECKFATAL(dns_dispatchmgr_create(named_g_mctx, named_g_loopmgr, named_g_netmgr, &named_g_dispatchmgr), diff --git a/lib/dns/adb.c b/lib/dns/adb.c index d0d30bd8da..a4cee65632 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -99,8 +99,6 @@ struct dns_adb { dns_view_t *view; dns_resolver_t *res; - isc_loopmgr_t *loopmgr; - isc_refcount_t references; dns_adbnamelist_t names_lru; @@ -1843,8 +1841,7 @@ ISC_REFCOUNT_IMPL(dns_adb, destroy); */ void -dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, - dns_adb_t **newadb) { +dns_adb_create(isc_mem_t *mem, dns_view_t *view, dns_adb_t **newadb) { dns_adb_t *adb = NULL; REQUIRE(mem != NULL); @@ -1853,7 +1850,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, adb = isc_mem_get(mem, sizeof(dns_adb_t)); *adb = (dns_adb_t){ - .loopmgr = loopmgr, .names_lru = ISC_LIST_INITIALIZER, .entries_lru = ISC_LIST_INITIALIZER, }; @@ -2994,8 +2990,8 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, unsigned int depth, */ result = dns_resolver_createfetch( adb->res, adbname->name, type, name, nameservers, NULL, NULL, 0, - options, depth, qc, isc_loop_current(adb->loopmgr), - fetch_callback, adbname, &fetch->rdataset, NULL, &fetch->fetch); + options, depth, qc, isc_loop(), fetch_callback, adbname, + &fetch->rdataset, NULL, &fetch->fetch); if (result != ISC_R_SUCCESS) { DP(ENTER_LEVEL, "fetch_name: createfetch failed with %s", isc_result_totext(result)); diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 809259b7bb..b81b3b810f 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -861,7 +861,7 @@ dns__catz_timer_start(dns_catz_zone_t *catz) { isc_interval_set(&interval, 0, 0); } - catz->loop = isc_loop_current(catz->catzs->loopmgr); + catz->loop = isc_loop(); isc_timer_create(catz->loop, dns__catz_timer_cb, catz, &catz->updatetimer); diff --git a/lib/dns/client.c b/lib/dns/client.c index c01558f80a..f0b0311b37 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -198,8 +198,8 @@ getudpdispatch(int family, dns_dispatchmgr_t *dispatchmgr, } static isc_result_t -createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr, - isc_nm_t *nm, isc_tlsctx_cache_t *tlsctx_client_cache, +createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_nm_t *nm, + isc_tlsctx_cache_t *tlsctx_client_cache, dns_dispatchmgr_t *dispatchmgr, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6, dns_view_t **viewp) { isc_result_t result; @@ -214,7 +214,7 @@ createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr, /* Initialize view security roots */ dns_view_initsecroots(view); - CHECK(dns_view_createresolver(view, loopmgr, nm, 0, tlsctx_client_cache, + CHECK(dns_view_createresolver(view, nm, 0, tlsctx_client_cache, dispatchv4, dispatchv6)); CHECK(dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname, dns_dbtype_cache, rdclass, 0, NULL, @@ -290,9 +290,8 @@ dns_client_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *nm, isc_refcount_init(&client->references, 1); /* Create the default view for class IN */ - result = createview(mctx, dns_rdataclass_in, loopmgr, nm, - tlsctx_client_cache, client->dispatchmgr, - dispatchv4, dispatchv6, &view); + result = createview(mctx, dns_rdataclass_in, nm, tlsctx_client_cache, + client->dispatchmgr, dispatchv4, dispatchv6, &view); if (result != ISC_R_SUCCESS) { goto cleanup_references; } diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 15977b1638..cf725b62fc 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -225,12 +225,11 @@ struct dns_adbaddrinfo { */ /**** -**** FUNCTIONS -****/ + **** FUNCTIONS + ****/ void -dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, - dns_adb_t **newadb); +dns_adb_create(isc_mem_t *mem, dns_view_t *view, dns_adb_t **newadb); /*%< * Create a new ADB. * @@ -245,8 +244,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_loopmgr_t *loopmgr, * *\li 'view' be a pointer to a valid view. * - *\li 'loopmgr' be a valid loop manager. - * *\li 'newadb' != NULL && '*newadb' == NULL. */ diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index dea045fc3a..b582828266 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -366,9 +366,8 @@ dns_view_weakdetach(dns_view_t **targetp); */ isc_result_t -dns_view_createresolver(dns_view_t *view, isc_loopmgr_t *loopmgr, - isc_nm_t *netmgr, unsigned int options, - isc_tlsctx_cache_t *tlsctx_cache, +dns_view_createresolver(dns_view_t *view, isc_nm_t *netmgr, + unsigned int options, isc_tlsctx_cache_t *tlsctx_cache, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6); /*%< * Create a resolver and address database for the view. diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 909795717d..ec5e8f9da1 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -1684,8 +1684,7 @@ dns_zone_findkeys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, */ void -dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *netmgr, - dns_zonemgr_t **zmgrp); +dns_zonemgr_create(isc_mem_t *mctx, isc_nm_t *netmgr, dns_zonemgr_t **zmgrp); /*%< * Create a zone manager. * diff --git a/lib/dns/nta.c b/lib/dns/nta.c index dad45a1ec0..abff2cba4f 100644 --- a/lib/dns/nta.c +++ b/lib/dns/nta.c @@ -282,7 +282,7 @@ nta_create(dns_ntatable_t *ntatable, const dns_name_t *name, .magic = NTA_MAGIC, }; isc_mem_attach(ntatable->mctx, &nta->mctx); - isc_loop_attach(isc_loop_current(ntatable->loopmgr), &nta->loop); + isc_loop_attach(isc_loop(), &nta->loop); dns_rdataset_init(&nta->rdataset); dns_rdataset_init(&nta->sigrdataset); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 4e1fc8ad90..c30cea1724 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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) { diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index d2ba6a54c3..5edf8338b6 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -1704,7 +1704,7 @@ dns__rpz_timer_start(dns_rpz_zone_t *rpz) { isc_interval_set(&interval, 0, 0); } - rpz->loop = isc_loop_current(rpz->rpzs->loopmgr); + rpz->loop = isc_loop(); isc_timer_create(rpz->loop, dns__rpz_timer_cb, rpz, &rpz->updatetimer); isc_timer_start(rpz->updatetimer, isc_timertype_once, &interval); diff --git a/lib/dns/view.c b/lib/dns/view.c index d277816252..d338c80afa 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -586,13 +586,13 @@ dns_view_weakdetach(dns_view_t **viewp) { } isc_result_t -dns_view_createresolver(dns_view_t *view, isc_loopmgr_t *loopmgr, - isc_nm_t *netmgr, unsigned int options, - isc_tlsctx_cache_t *tlsctx_cache, +dns_view_createresolver(dns_view_t *view, isc_nm_t *netmgr, + unsigned int options, isc_tlsctx_cache_t *tlsctx_cache, dns_dispatch_t *dispatchv4, dns_dispatch_t *dispatchv6) { isc_result_t result; isc_mem_t *mctx = NULL; + isc_loopmgr_t *loopmgr = isc_loop_getloopmgr(isc_loop()); REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(!view->frozen); @@ -608,7 +608,7 @@ dns_view_createresolver(dns_view_t *view, isc_loopmgr_t *loopmgr, isc_mem_create(&mctx); isc_mem_setname(mctx, "ADB"); - dns_adb_create(mctx, view, loopmgr, &view->adb); + dns_adb_create(mctx, view, &view->adb); isc_mem_detach(&mctx); result = dns_requestmgr_create(view->mctx, loopmgr, view->dispatchmgr, diff --git a/lib/dns/zone.c b/lib/dns/zone.c index edac498c67..d70155bf74 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -18764,13 +18764,12 @@ zonemgr_keymgmt_delete(dns_zonemgr_t *zmgr, dns_keyfileio_t **deleted) { } void -dns_zonemgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, isc_nm_t *netmgr, - dns_zonemgr_t **zmgrp) { +dns_zonemgr_create(isc_mem_t *mctx, isc_nm_t *netmgr, dns_zonemgr_t **zmgrp) { dns_zonemgr_t *zmgr = NULL; - isc_loop_t *loop = isc_loop_current(loopmgr); + isc_loop_t *loop = isc_loop(); + isc_loopmgr_t *loopmgr = isc_loop_getloopmgr(loop); REQUIRE(mctx != NULL); - REQUIRE(loopmgr != NULL); REQUIRE(netmgr != NULL); REQUIRE(zmgrp != NULL && *zmgrp == NULL); diff --git a/lib/isc/include/isc/loop.h b/lib/isc/include/isc/loop.h index a434190cc4..ef34bd2ca4 100644 --- a/lib/isc/include/isc/loop.h +++ b/lib/isc/include/isc/loop.h @@ -27,6 +27,16 @@ typedef void (*isc_job_cb)(void *); ISC_LANG_BEGINDECLS +/*%< + * Returns the current running loop. + */ + +extern thread_local isc_loop_t *isc__loop_local; + +static inline isc_loop_t * +isc_loop(void) { + return (isc__loop_local); +} void isc_loopmgr_create(isc_mem_t *mctx, uint32_t nloops, isc_loopmgr_t **loopmgrp); /*%< diff --git a/lib/isc/loop.c b/lib/isc/loop.c index 829cf168a4..77cc9c614e 100644 --- a/lib/isc/loop.c +++ b/lib/isc/loop.c @@ -46,6 +46,8 @@ * Private */ +thread_local isc_loop_t *isc__loop_local = NULL; + static void ignore_signal(int sig, void (*handler)(int)) { struct sigaction sa = { .sa_handler = handler }; @@ -263,8 +265,10 @@ loop_close(isc_loop_t *loop) { static void * loop_thread(void *arg) { isc_loop_t *loop = (isc_loop_t *)arg; + /* Initialize the thread_local variables*/ - /* Initialize the thread_local variable */ + REQUIRE(isc__loop_local == NULL || isc__loop_local == loop); + isc__loop_local = loop; isc__tid_init(loop->tid); @@ -284,6 +288,8 @@ loop_thread(void *arg) { r = uv_run(&loop->loop, UV_RUN_DEFAULT); UV_RUNTIME_CHECK(uv_run, r); + isc__loop_local = NULL; + /* Invalidate the loop early */ loop->magic = 0; diff --git a/lib/isc/timer.c b/lib/isc/timer.c index e277ea7559..4d30409084 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -61,8 +61,7 @@ isc_timer_create(isc_loop_t *loop, isc_job_cb cb, void *cbarg, loopmgr = loop->loopmgr; REQUIRE(VALID_LOOPMGR(loopmgr)); - - REQUIRE(loop == isc_loop_current(loopmgr)); + REQUIRE(loop == isc_loop()); timer = isc_mem_get(loop->mctx, sizeof(*timer)); *timer = (isc_timer_t){ @@ -92,7 +91,7 @@ isc_timer_stop(isc_timer_t *timer) { } /* Stop the timer, if the loops are matching */ - if (timer->loop == isc_loop_current(timer->loop->loopmgr)) { + if (timer->loop == isc_loop()) { uv_timer_stop(&timer->timer); } } @@ -120,7 +119,7 @@ isc_timer_start(isc_timer_t *timer, isc_timertype_t type, REQUIRE(VALID_TIMER(timer)); REQUIRE(type == isc_timertype_ticker || type == isc_timertype_once); - REQUIRE(timer->loop == isc_loop_current(timer->loop->loopmgr)); + REQUIRE(timer->loop == isc_loop()); loop = timer->loop; @@ -180,7 +179,7 @@ isc_timer_destroy(isc_timer_t **timerp) { timer = *timerp; *timerp = NULL; - REQUIRE(timer->loop == isc_loop_current(timer->loop->loopmgr)); + REQUIRE(timer->loop == isc_loop()); timer_destroy(timer); } diff --git a/tests/bench/qpmulti.c b/tests/bench/qpmulti.c index df0b81adbb..590b90b5a5 100644 --- a/tests/bench/qpmulti.c +++ b/tests/bench/qpmulti.c @@ -207,7 +207,7 @@ struct thread_args { static void first_loop(void *varg) { struct thread_args *args = varg; - isc_loop_t *loop = isc_loop_current(args->loopmgr); + isc_loop_t *loop = isc_loop(); isc_job_run(loop, &args->job, args->cb, args); @@ -222,8 +222,7 @@ next_loop(struct thread_args *args, isc_nanosecs_t start) { args->worked += stop - start; args->stop = stop; if (args->stop - args->start < RUNTIME) { - isc_job_run(isc_loop_current(args->loopmgr), &args->job, - args->cb, args); + isc_job_run(isc_loop(), &args->job, args->cb, args); return; } isc_async_run(isc_loop_main(args->loopmgr), collect, args); @@ -809,7 +808,7 @@ collect(void *varg) { static void startup(void *arg) { isc_loopmgr_t *loopmgr = arg; - isc_loop_t *loop = isc_loop_current(loopmgr); + isc_loop_t *loop = isc_loop(); isc_mem_t *mctx = isc_loop_getmctx(loop); uint32_t nloops = isc_loopmgr_nloops(loopmgr); size_t bytes = sizeof(struct bench_state) + @@ -841,7 +840,7 @@ tick(void *varg) { static void start_ticker(void *varg) { struct ticker *ticker = varg; - isc_loop_t *loop = isc_loop_current(ticker->loopmgr); + isc_loop_t *loop = isc_loop(); isc_timer_create(loop, tick, NULL, &ticker->timer); isc_timer_start(ticker->timer, isc_timertype_ticker, diff --git a/tests/dns/zonemgr_test.c b/tests/dns/zonemgr_test.c index 3d7c3b688b..268d65f75e 100644 --- a/tests/dns/zonemgr_test.c +++ b/tests/dns/zonemgr_test.c @@ -55,7 +55,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_create) { UNUSED(arg); - dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr); + dns_zonemgr_create(mctx, netmgr, &myzonemgr); dns_zonemgr_shutdown(myzonemgr); dns_zonemgr_detach(&myzonemgr); @@ -72,7 +72,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_managezone) { UNUSED(arg); - dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr); + dns_zonemgr_create(mctx, netmgr, &myzonemgr); result = dns_test_makezone("foo", &zone, NULL, false); assert_int_equal(result, ISC_R_SUCCESS); @@ -105,7 +105,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_createzone) { UNUSED(arg); - dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr); + dns_zonemgr_create(mctx, netmgr, &myzonemgr); result = dns_zonemgr_createzone(myzonemgr, &zone); assert_int_equal(result, ISC_R_SUCCESS); @@ -136,7 +136,7 @@ ISC_LOOP_TEST_IMPL(zonemgr_unreachable) { now = isc_time_now(); - dns_zonemgr_create(mctx, loopmgr, netmgr, &myzonemgr); + dns_zonemgr_create(mctx, netmgr, &myzonemgr); result = dns_test_makezone("foo", &zone, NULL, false); assert_int_equal(result, ISC_R_SUCCESS); diff --git a/tests/isc/async_test.c b/tests/isc/async_test.c index c56a12b75b..bfc417362d 100644 --- a/tests/isc/async_test.c +++ b/tests/isc/async_test.c @@ -82,7 +82,7 @@ append(void *arg) { static void async_multiple(void *arg) { - isc_loop_t *loop = isc_loop_current(loopmgr); + isc_loop_t *loop = isc_loop(); UNUSED(arg); diff --git a/tests/isc/job_test.c b/tests/isc/job_test.c index 4a353a86eb..6376bcc135 100644 --- a/tests/isc/job_test.c +++ b/tests/isc/job_test.c @@ -62,10 +62,9 @@ job_cb(void *arg) { if (n <= MAX_EXECUTED) { atomic_fetch_add(&scheduled, 1); - isc_job_run(isc_loop_current(loopmgr), &ta->job, job_cb, ta); + isc_job_run(isc_loop(), &ta->job, job_cb, ta); } else { - isc_job_run(isc_loop_current(loopmgr), &ta->job, shutdown_cb, - ta); + isc_job_run(isc_loop(), &ta->job, shutdown_cb, ta); } } @@ -79,7 +78,7 @@ job_run_cb(void *arg) { *ta = (struct test_arg){ .job = ISC_JOB_INITIALIZER }; } - isc_job_run(isc_loop_current(loopmgr), &ta->job, job_cb, ta); + isc_job_run(isc_loop(), &ta->job, job_cb, ta); } ISC_RUN_TEST_IMPL(isc_job_run) { diff --git a/tests/isc/timer_test.c b/tests/isc/timer_test.c index e0a1b15473..3c8efd1ded 100644 --- a/tests/isc/timer_test.c +++ b/tests/isc/timer_test.c @@ -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; diff --git a/tests/libtest/dns.c b/tests/libtest/dns.c index d3d57a3df5..e57a6820e8 100644 --- a/tests/libtest/dns.c +++ b/tests/libtest/dns.c @@ -170,7 +170,7 @@ void dns_test_setupzonemgr(void) { REQUIRE(zonemgr == NULL); - dns_zonemgr_create(mctx, loopmgr, netmgr, &zonemgr); + dns_zonemgr_create(mctx, netmgr, &zonemgr); } isc_result_t