summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_init.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2004-08-12 12:12:12 +0000
committerdeischen <deischen@FreeBSD.org>2004-08-12 12:12:12 +0000
commit0340faafa1e860a32729f20649b0e508d257006e (patch)
treef5cde2cd4e3f3ec2684cfd283ab1b57e8981d4b1 /lib/libpthread/thread/thr_init.c
parent328c4c7fcefd02207b2a88ae95b841d9721afeec (diff)
downloadFreeBSD-src-0340faafa1e860a32729f20649b0e508d257006e.zip
FreeBSD-src-0340faafa1e860a32729f20649b0e508d257006e.tar.gz
As long as we have a knob to force system scope threads, why not have
a knob to force process scope threads. If the environment variable LIBPTHREAD_PROCESS_SCOPE is set, force all threads to be process scope threads regardless of how the application creates them. If LIBPTHREAD_SYSTEM_SCOPE is set (forcing system scope threads), it overrides LIBPTHREAD_PROCESS_SCOPE. $ # To force system scope threads $ LIBPTHREAD_SYSTEM_SCOPE=anything threaded_app $ # To force process scope threads $ LIBPTHREAD_PROCESS_SCOPE=anything threaded_app
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
-rw-r--r--lib/libpthread/thread/thr_init.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index 6c371b0..baee1bb 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -258,7 +258,7 @@ _libpthread_init(struct pthread *curthread)
_kse_init();
/* Initialize the initial kse and kseg. */
- _kse_initial = _kse_alloc(NULL, _thread_scope_system);
+ _kse_initial = _kse_alloc(NULL, _thread_scope_system > 0);
if (_kse_initial == NULL)
PANIC("Can't allocate initial kse.");
_kse_initial->k_kseg = _kseg_alloc(NULL);
@@ -469,6 +469,8 @@ init_private(void)
#else
if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL)
_thread_scope_system = 1;
+ else if (getenv("LIBPTHREAD_PROCESS_SCOPE") != NULL)
+ _thread_scope_system = -1;
#endif
/*
OpenPOWER on IntegriCloud