about summary refs log tree commit diff
path: root/nptl/pthread_attr_getstacksize.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_attr_getstacksize.c')
-rw-r--r--nptl/pthread_attr_getstacksize.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nptl/pthread_attr_getstacksize.c b/nptl/pthread_attr_getstacksize.c
index 42d3f8f44c..84c31cd6e4 100644
--- a/nptl/pthread_attr_getstacksize.c
+++ b/nptl/pthread_attr_getstacksize.c
@@ -30,9 +30,17 @@ __pthread_attr_getstacksize (attr, stacksize)
   assert (sizeof (*attr) >= sizeof (struct pthread_attr));
   iattr = (struct pthread_attr *) attr;
 
+  size_t size = iattr->stacksize;
+
   /* If the user has not set a stack size we return what the system
      will use as the default.  */
-  *stacksize = iattr->stacksize ?: __default_pthread_attr.stacksize;
+  if (size == 0)
+    {
+      lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
+      size = __default_pthread_attr.stacksize;
+      lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
+    }
+  *stacksize = size;
 
   return 0;
 }