mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-27 20:49:04 +00:00
Instead of high number of dispatches (4 * named_g_udpdisp)[1], make the dispatches bound to threads and make dns_dispatchset_t create a dispatch for each thread (event loop). This required couple of other changes: 1. The dns_dispatch_createudp() must be called on loop, so the isc_tid() is already initialized - changes to nsupdate and mdig were required. 2. The dns_requestmgr had only a single dispatch per v4 and v6. Instead of using single dispatch, use dns_dispatchset_t for each protocol - this is same as dns_resolver.
58 lines
1.1 KiB
C
58 lines
1.1 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
#include <isc/lang.h>
|
|
#include <isc/thread.h>
|
|
#include <isc/tid.h>
|
|
#include <isc/util.h>
|
|
|
|
/**
|
|
* Private
|
|
*/
|
|
thread_local uint32_t isc__tid_local = ISC_TID_UNKNOWN;
|
|
|
|
/*
|
|
* Zero is a better nonsense value in this case than ISC_TID_UNKNOWN;
|
|
* avoids things like trying to allocate 32GB of per-thread counters.
|
|
*/
|
|
static uint32_t tid_count = 0;
|
|
|
|
/**
|
|
* Protected
|
|
*/
|
|
|
|
void
|
|
isc__tid_init(uint32_t tid) {
|
|
REQUIRE(isc__tid_local == ISC_TID_UNKNOWN || isc__tid_local == tid);
|
|
isc__tid_local = tid;
|
|
}
|
|
|
|
void
|
|
isc__tid_initcount(uint32_t count) {
|
|
REQUIRE(tid_count == 0 || tid_count == count);
|
|
tid_count = count;
|
|
}
|
|
|
|
/**
|
|
* Public
|
|
*/
|
|
|
|
uint32_t
|
|
isc_tid_count(void) {
|
|
return (tid_count);
|
|
}
|