diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-14 15:20:01 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-14 15:20:01 +0000 |
commit | 2ea0eaec298962ba0bd903aef0941f35cf3db511 (patch) | |
tree | 8a20396d0e9f20b4f1bedc45a3b8705cd1c7a576 /libgomp/env.c | |
parent | 0aacf12c55490c22e0f0efcc797fb1dbe36a7090 (diff) | |
download | gcc-2ea0eaec298962ba0bd903aef0941f35cf3db511.tar.gz |
PR libgomp/28008
* env.c (initialize_env): Avoid using PTHREAD_STACK_MIN when
undefined. Use GOMP_STACKSIZE not OMP_STACKSIZE for environment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114643 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/env.c')
-rw-r--r-- | libgomp/env.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/libgomp/env.c b/libgomp/env.c index d42e68e6a3c..c86ebc6d855 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -166,21 +166,27 @@ initialize_env (void) pthread_attr_init (&gomp_thread_attr); pthread_attr_setdetachstate (&gomp_thread_attr, PTHREAD_CREATE_DETACHED); - if (parse_unsigned_long ("OMP_STACKSIZE", &stacksize)) + if (parse_unsigned_long ("GOMP_STACKSIZE", &stacksize)) { + int err; + stacksize *= 1024; - if (stacksize < PTHREAD_STACK_MIN) - gomp_error ("Stack size less than minimum of %luk", - PTHREAD_STACK_MIN / 1024ul - + (PTHREAD_STACK_MIN % 1024 != 0)); - else + err = pthread_attr_setstacksize (&gomp_thread_attr, stacksize); + +#ifdef PTHREAD_STACK_MIN + if (err == EINVAL) { - int err = pthread_attr_setstacksize (&gomp_thread_attr, stacksize); - if (err == EINVAL) + if (stacksize < PTHREAD_STACK_MIN) + gomp_error ("Stack size less than minimum of %luk", + PTHREAD_STACK_MIN / 1024ul + + (PTHREAD_STACK_MIN % 1024 != 0)); + else gomp_error ("Stack size larger than system limit"); - else if (err != 0) - gomp_error ("Stack size change failed: %s", strerror (err)); } + else +#endif + if (err != 0) + gomp_error ("Stack size change failed: %s", strerror (err)); } } |