summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_init.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-12-15 11:52:01 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-12-15 11:52:01 +0000
commitca278718335da1ed4af28e199e5459b0a6fadd2a (patch)
treeea09b321c6b33b576a254a34f061222ae4c103b0 /lib/libthr/thread/thr_init.c
parent8ec27d6b35247153cee3394ff6c7e8ef85e63ff3 (diff)
downloadFreeBSD-src-ca278718335da1ed4af28e199e5459b0a6fadd2a.zip
FreeBSD-src-ca278718335da1ed4af28e199e5459b0a6fadd2a.tar.gz
- Remove variable _thr_scope_system, all threads are system scope.
- Rename _thr_smp_cpus to boolean variable _thr_is_smp. - Define CPU_SPINWAIT macro for each arch, only X86 supports it.
Diffstat (limited to 'lib/libthr/thread/thr_init.c')
-rw-r--r--lib/libthr/thread/thr_init.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index ae4ea33..981941b 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -58,7 +58,6 @@
char *_usrstack;
struct pthread *_thr_initial;
-int _thr_scope_system;
int _libthr_debug;
int _thread_event_mask;
struct pthread *_thread_last_event;
@@ -99,7 +98,7 @@ struct pthread_cond_attr _pthread_condattr_default = {
};
pid_t _thr_pid;
-int _thr_smp_cpus = 1;
+int _thr_is_smp = 0;
size_t _thr_guard_default;
size_t _thr_stack_default = THR_STACK_DEFAULT;
size_t _thr_stack_initial = THR_STACK_INITIAL;
@@ -446,22 +445,15 @@ 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);
+ len = sizeof(_thr_is_smp);
+ sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0);
+ _thr_is_smp = (_thr_is_smp > 1);
_thr_page_size = getpagesize();
_thr_guard_default = _thr_page_size;
_pthread_attr_default.guardsize_attr = _thr_guard_default;
_pthread_attr_default.stacksize_attr = _thr_stack_default;
TAILQ_INIT(&_thr_atfork_list);
-#ifdef SYSTEM_SCOPE_ONLY
- _thr_scope_system = 1;
-#else
- if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL)
- _thr_scope_system = 1;
- else if (getenv("LIBPTHREAD_PROCESS_SCOPE") != NULL)
- _thr_scope_system = -1;
-#endif
}
init_once = 1;
}
OpenPOWER on IntegriCloud