From 0340faafa1e860a32729f20649b0e508d257006e Mon Sep 17 00:00:00 2001 From: deischen Date: Thu, 12 Aug 2004 12:12:12 +0000 Subject: 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 --- lib/libkse/thread/thr_create.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libkse/thread/thr_create.c') diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c index 8c4592a..54bcd3b 100644 --- a/lib/libkse/thread/thr_create.c +++ b/lib/libkse/thread/thr_create.c @@ -126,8 +126,11 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, */ } } - if (_thread_scope_system != 0) + if (_thread_scope_system > 0) new_thread->attr.flags |= PTHREAD_SCOPE_SYSTEM; + else if ((_thread_scope_system < 0) + && (thread != &_thr_sig_daemon)) + new_thread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM; if (create_stack(&new_thread->attr) != 0) { /* Insufficient memory to create a stack: */ ret = EAGAIN; -- cgit v1.1