static isc_result_t
create_managers(void) {
+ bool capped = false;
+
/*
* Set the default named_g_cpus if it was not set from the command line
*/
named_g_cpus = named_g_cpus_detected;
}
- isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
- ISC_LOG_INFO, "found %u CPU%s, using %u worker thread%s",
- named_g_cpus_detected,
- named_g_cpus_detected == 1 ? "" : "s", named_g_cpus,
- named_g_cpus == 1 ? "" : "s");
+ if (named_g_cpus > ISC_TID_MAX) {
+ capped = true;
+ named_g_cpus = ISC_TID_MAX;
+ }
+
+ isc_log_write(
+ NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
+ "found %u CPU%s, using %u worker thread%s%s",
+ named_g_cpus_detected, named_g_cpus_detected == 1 ? "" : "s",
+ named_g_cpus, named_g_cpus == 1 ? "" : "s",
+ capped ? " (recompile with -DISC_TID_MAX=<n> to raise the "
+ "thread count limit)"
+ : "");
isc_managers_create(&named_g_mctx, named_g_cpus, &named_g_loopmgr,
&named_g_netmgr);
void
isc__tid_init(isc_tid_t tid) {
REQUIRE(isc__tid_local == ISC_TID_UNKNOWN || isc__tid_local == tid);
+ REQUIRE(tid < ISC_TID_MAX);
isc__tid_local = tid;
}
void
isc__tid_initcount(isc_tid_t count) {
REQUIRE(tid_count == 0 || tid_count == count);
+ REQUIRE(tid_count < ISC_TID_MAX);
tid_count = count;
}