summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_init.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-08-08 04:42:41 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-08-08 04:42:41 +0000
commitcfa46376c709e58e6cdbe41e2d8674dc0ee29184 (patch)
treeb35cd73f8796696f70ac2128fab255ddaa5c9969 /lib/libthr/thread/thr_init.c
parentae9a521b0529c447bd5d6355a0690c7b2af3ad5c (diff)
downloadFreeBSD-src-cfa46376c709e58e6cdbe41e2d8674dc0ee29184.zip
FreeBSD-src-cfa46376c709e58e6cdbe41e2d8674dc0ee29184.tar.gz
Get number of CPUs and ignore spin count on single processor machine.
Diffstat (limited to 'lib/libthr/thread/thr_init.c')
-rw-r--r--lib/libthr/thread/thr_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index 1150985..5d1aae5 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -99,6 +99,7 @@ struct pthread_cond_attr _pthread_condattr_default = {
};
pid_t _thr_pid;
+int _thr_smp_cpus = 1;
size_t _thr_guard_default;
size_t _thr_stack_default = THR_STACK_DEFAULT;
size_t _thr_stack_initial = THR_STACK_INITIAL;
@@ -443,6 +444,8 @@ init_private(void)
len = sizeof (_usrstack);
if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1)
PANIC("Cannot get kern.usrstack from sysctl");
+ len = sizeof(_thr_smp_cpus);
+ sysctlbyname("kern.smp.cpus", &_thr_smp_cpus, &len, NULL, 0);
_thr_page_size = getpagesize();
_thr_guard_default = _thr_page_size;
_pthread_attr_default.guardsize_attr = _thr_guard_default;
OpenPOWER on IntegriCloud