diff options
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r-- | nptl/allocatestack.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 56bf2570f8..1e0fe1f18d 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -358,7 +358,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, /* Get the stack size from the attribute if it is set. Otherwise we use the default we determined at start time. */ - size = attr->stacksize ?: __default_pthread_attr.stacksize; + if (attr->stacksize != 0) + size = attr->stacksize; + else + { + lll_lock (__default_pthread_attr_lock, LLL_PRIVATE); + size = __default_pthread_attr.stacksize; + lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE); + } /* Get memory for the stack. */ if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0)) @@ -919,8 +926,9 @@ __reclaim_stacks (void) in_flight_stack = 0; - /* Initialize the lock. */ + /* Initialize locks. */ stack_cache_lock = LLL_LOCK_INITIALIZER; + __default_pthread_attr_lock = LLL_LOCK_INITIALIZER; } |