Make netmgr the authority on number of threads running

Instead of passing the "workers" variable back and forth along with
passing the single isc_nm_t instance, add isc_nm_getnworkers() function
that returns the number of netmgr threads are running.

Change the ns_interfacemgr and ns_taskmgr to utilize the newly acquired
knowledge.
This commit is contained in:
Ondřej Surý
2022-03-18 09:50:58 +01:00
parent 4761213e80
commit d70daa29f7
9 changed files with 54 additions and 47 deletions

View File

@@ -65,7 +65,6 @@ ns_clientmgr_t *clientmgr = NULL;
ns_interfacemgr_t *interfacemgr = NULL;
ns_server_t *sctx = NULL;
bool app_running = false;
int ncpus;
bool debug_mem_record = true;
static atomic_bool run_managers = false;
@@ -224,7 +223,7 @@ create_managers(void) {
in_port_t port = 5300 + isc_random8();
ns_listenlist_t *listenon = NULL;
isc_event_t *event = NULL;
ncpus = isc_os_ncpus();
int ncpus = isc_os_ncpus();
isc_managers_create(mctx, ncpus, 0, &netmgr, &taskmgr, &timermgr);
CHECK(isc_task_create_bound(taskmgr, 0, &maintask, 0));
@@ -236,7 +235,7 @@ create_managers(void) {
CHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
CHECK(ns_interfacemgr_create(mctx, sctx, taskmgr, timermgr, netmgr,
dispatchmgr, maintask, NULL, ncpus, false,
dispatchmgr, maintask, NULL, false,
&interfacemgr));
CHECK(ns_listenlist_default(mctx, port, -1, true, AF_INET, &listenon));

View File

@@ -62,7 +62,6 @@ extern ns_clientmgr_t *clientmgr;
extern ns_interfacemgr_t *interfacemgr;
extern ns_server_t *sctx;
extern bool app_running;
extern int ncpus;
extern bool debug_mem_record;
#ifdef NETMGR_TRACE