Merge pull request #4232 from Feoramund/test-sync

Add test suites for `core:sync` and `core:sync/chan`
This commit is contained in:
gingerBill
2024-09-16 17:27:20 +01:00
committed by GitHub
23 changed files with 1168 additions and 174 deletions
+10 -2
View File
@@ -3195,11 +3195,11 @@ void gb_affinity_init(gbAffinity *a) {
a->core_count = 1;
a->threads_per_core = 1;
if (sysctlbyname("hw.logicalcpu", &count, &count_size, NULL, 0) == 0) {
if (sysctlbyname("kern.smp.cpus", &count, &count_size, NULL, 0) == 0) {
if (count > 0) {
a->thread_count = count;
// Get # of physical cores
if (sysctlbyname("hw.physicalcpu", &count, &count_size, NULL, 0) == 0) {
if (sysctlbyname("kern.smp.cores", &count, &count_size, NULL, 0) == 0) {
if (count > 0) {
a->core_count = count;
a->threads_per_core = a->thread_count / count;
@@ -3210,6 +3210,14 @@ void gb_affinity_init(gbAffinity *a) {
}
}
}
} else if (sysctlbyname("hw.ncpu", &count, &count_size, NULL, 0) == 0) {
// SMP disabled or unavailable.
if (count > 0) {
a->is_accurate = true;
a->thread_count = count;
a->core_count = count;
a->threads_per_core = 1;
}
}
}