diff options
author | deischen <deischen@FreeBSD.org> | 2004-08-07 15:15:38 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2004-08-07 15:15:38 +0000 |
commit | 628d407e8490a240e6c73a5e9994986e7a9ab164 (patch) | |
tree | a52137064a9f6d0ca8cd37a63377945781591df2 /lib/libpthread/thread/thr_init.c | |
parent | 51abab44f50b76d38ee3599125e7890346cd5279 (diff) | |
download | FreeBSD-src-628d407e8490a240e6c73a5e9994986e7a9ab164.zip FreeBSD-src-628d407e8490a240e6c73a5e9994986e7a9ab164.tar.gz |
Add a way to force 1:1 mode for libpthread. To do this, define
LIBPTHREAD_SYSTEM_SCOPE in the environment.
You can still force libpthread to be built in strictly 1:1 by
adding -DSYSTEM_SCOPE_ONLY to CFLAGS. This is kept for archs
that don't yet support M:N mode.
Requested by: rwatson
Reviewed by: davidxu
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
-rw-r--r-- | lib/libpthread/thread/thr_init.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index 36e7e69..6c371b0 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -258,11 +258,7 @@ _libpthread_init(struct pthread *curthread) _kse_init(); /* Initialize the initial kse and kseg. */ -#ifdef SYSTEM_SCOPE_ONLY - _kse_initial = _kse_alloc(NULL, 1); -#else - _kse_initial = _kse_alloc(NULL, 0); -#endif + _kse_initial = _kse_alloc(NULL, _thread_scope_system); if (_kse_initial == NULL) PANIC("Can't allocate initial kse."); _kse_initial->k_kseg = _kseg_alloc(NULL); @@ -467,6 +463,14 @@ init_private(void) /* Clear pending signals and get the process signal mask. */ SIGEMPTYSET(_thr_proc_sigpending); + /* Are we in M:N mode (default) or 1:1 mode? */ +#ifdef SYSTEM_SCOPE_ONLY + _thread_scope_system = 1; +#else + if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL) + _thread_scope_system = 1; +#endif + /* * _thread_list_lock and _kse_count are initialized * by _kse_init() |