mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +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:
parent
cad6292fc4
commit
c47fa689d4
@ -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);
|
||||
|
@ -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),
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
/*%<
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user