]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
use a thread-local variable to get the current running loop
authorEvan Hunt <each@isc.org>
Tue, 26 Mar 2024 07:13:45 +0000 (00:13 -0700)
committerOndřej Surý <ondrej@isc.org>
Tue, 2 Apr 2024 08:35:56 +0000 (10:35 +0200)
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.

22 files changed:
bin/delv/delv.c
bin/named/server.c
lib/dns/adb.c
lib/dns/catz.c
lib/dns/client.c
lib/dns/include/dns/adb.h
lib/dns/include/dns/view.h
lib/dns/include/dns/zone.h
lib/dns/nta.c
lib/dns/resolver.c
lib/dns/rpz.c
lib/dns/view.c
lib/dns/zone.c
lib/isc/include/isc/loop.h
lib/isc/loop.c
lib/isc/timer.c
tests/bench/qpmulti.c
tests/dns/zonemgr_test.c
tests/isc/async_test.c
tests/isc/job_test.c
tests/isc/timer_test.c
tests/libtest/dns.c

index c3b2d1c6f28ad278a29fd2e64eedff967fa03cc5..31d44667e93d53eca06d172c3fea519b002cb15a 100644 (file)
@@ -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);
index 04116bb36505776656b2b4a37fe6b5b586e2a391..a0f8741aa54030d00d14a4ad0235f2b898fdc796 100644 (file)
@@ -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),
index d0d30bd8dac1f7097e5759f00915240e69a4dbab..a4cee65632e6822ca1f03be895bd2737e6561656 100644 (file)
@@ -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));
index 809259b7bbe88487363b2286c7dc266d0d883612..b81b3b810f60ee28e2a4170674f67b64cb89139c 100644 (file)
@@ -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);
index c01558f80a4568b8688b13e76baa468e8ae87450..f0b0311b37c82b1089fb753b1a2269475943db6a 100644 (file)
@@ -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;
        }
index 15977b16381dfff03a21fc112b62851617a557c8..cf725b62fc816d9ab5bf60814ca2a886e662e984 100644 (file)
@@ -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.
  */
 
index dea045fc3a686728ad1a8129b4b40e4616538b77..b58282826648b1788ea48859839da216d929a285 100644 (file)
@@ -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.
index 909795717d6ca706b0423ac72cd26e92ecd1cca2..ec5e8f9da12336b0252d262c889e5bdf35a9f3e5 100644 (file)
@@ -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.
  *
index dad45a1ec0fe0ebf4dd09b63bfe64e27c2452a62..abff2cba4ffd95cae65a0fe04b1dd7b7cfa1281c 100644 (file)
@@ -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);
index 4e1fc8ad90ccc64782af059c38613a881e54e092..c30cea17244cc42e6fef2b92b1cbd6281627757e 100644 (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) {
index d2ba6a54c365fe6eacbfd4c0ecc68ab8b87179be..5edf8338b66ddd7f30d788d3177e6045a86ac66c 100644 (file)
@@ -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);
index d277816252ba2548e3e867777061fcea5c96cca5..d338c80afa152c9e7011b15997c3743d985561d1 100644 (file)
@@ -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,
index edac498c67e30f4464b6b2d2e64519f6f3e40f03..d70155bf7465d45100d5f5f6a93b767fdf42e31b 100644 (file)
@@ -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);
 
index a434190cc402db6ac7ab125c43fd66a27e0af886..ef34bd2ca4e2252dc28012aeda7f74cba7b29828 100644 (file)
@@ -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);
 /*%<
index 829cf168a46174f72aca6ebf71c828bff3c6b928..77cc9c614ef8b369aef26f09957d070910e92666 100644 (file)
@@ -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;
 
index e277ea7559f523cf663a3e80c8128122e605269c..4d30409084844b9df4a16e17e13e8ba487c0b53c 100644 (file)
@@ -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);
 }
index df0b81adbbd65c2dd1195448a267835a1320d813..590b90b5a5da467ca2b72ea20fb55cc66f79df16 100644 (file)
@@ -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,
index 3d7c3b688b315f640f097bd3e63162d4ec506b21..268d65f75eeb8b2e788527503e7accba804f7f34 100644 (file)
@@ -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);
index c56a12b75b2b2e6b5af3cc8809d6525782e583ae..bfc417362d6ce816541161740c2957131bc39405 100644 (file)
@@ -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);
 
index 4a353a86ebe8d7b759c73348250c713ec5346364..6376bcc1353d201398345b8ba8e8307853564844 100644 (file)
@@ -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) {
index e0a1b154738877152ecbfbe5b0ca74fabd74bc11..3c8efd1dedc8e0b055014a8db0da5ae2c0b6587f 100644 (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;
index d3d57a3df57c7943e0ecd428afb3cd021288f88b..e57a6820e8da923eadea6bbd949b482bef4082a1 100644 (file)
@@ -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