Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libthr/thread/thr_init.c
Show First 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) | ||||
PANIC("Cannot get kern.usrstack from sysctl"); | PANIC("Cannot get kern.usrstack from sysctl"); | ||||
env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN"); | env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN"); | ||||
env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN"); | env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN"); | ||||
if (env_bigstack != NULL || env_splitstack == NULL) { | if (env_bigstack != NULL || env_splitstack == NULL) { | ||||
if (getrlimit(RLIMIT_STACK, &rlim) == -1) | if (getrlimit(RLIMIT_STACK, &rlim) == -1) | ||||
PANIC("Cannot get stack rlimit"); | PANIC("Cannot get stack rlimit"); | ||||
_thr_stack_initial = rlim.rlim_cur; | _thr_stack_initial = rlim.rlim_cur; | ||||
} | } | ||||
len = sizeof(_thr_is_smp); | _thr_is_smp = sysconf(_SC_NPROCESSORS_CONF); | ||||
sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0); | if (_thr_is_smp == -1) | ||||
PANIC("Cannot get _SC_NPROCESSORS_CONF"); | |||||
_thr_is_smp = (_thr_is_smp > 1); | _thr_is_smp = (_thr_is_smp > 1); | ||||
_thr_page_size = getpagesize(); | _thr_page_size = getpagesize(); | ||||
_thr_guard_default = _thr_page_size; | _thr_guard_default = _thr_page_size; | ||||
_pthread_attr_default.guardsize_attr = _thr_guard_default; | _pthread_attr_default.guardsize_attr = _thr_guard_default; | ||||
_pthread_attr_default.stacksize_attr = _thr_stack_default; | _pthread_attr_default.stacksize_attr = _thr_stack_default; | ||||
env = getenv("LIBPTHREAD_SPINLOOPS"); | env = getenv("LIBPTHREAD_SPINLOOPS"); | ||||
if (env) | if (env) | ||||
_thr_spinloops = atoi(env); | _thr_spinloops = atoi(env); | ||||
Show All 10 Lines |