about summary refs log tree commit diff
path: root/src/thread/pthread_create.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-11-07 20:47:24 -0500
committerRich Felker <dalias@aerifal.cx>2016-11-07 20:47:24 -0500
commit33ce920857405d4f4b342c85b74588a15e2702e5 (patch)
tree54c7c840b40b68aa52f68a0a69c9e61b9ac4c388 /src/thread/pthread_create.c
parent7442442ccc665641a8827177e8e7ed45bbbd6584 (diff)
downloadmusl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.gz
musl-33ce920857405d4f4b342c85b74588a15e2702e5.tar.xz
musl-33ce920857405d4f4b342c85b74588a15e2702e5.zip
simplify pthread_attr_t stack/guard size representation
previously, the pthread_attr_t object was always initialized all-zero,
and stack/guard size were represented as differences versus their
defaults. this required lots of confusing offset arithmetic everywhere
they were used. instead, have pthread_attr_init fill in the default
values, and work with absolute sizes everywhere.
Diffstat (limited to 'src/thread/pthread_create.c')
-rw-r--r--src/thread/pthread_create.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 9f6b98e6..db9e575e 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -208,7 +208,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
 
 	if (attr._a_stackaddr) {
 		size_t need = libc.tls_size + __pthread_tsd_size;
-		size = attr._a_stacksize + DEFAULT_STACK_SIZE;
+		size = attr._a_stacksize;
 		stack = (void *)(attr._a_stackaddr & -16);
 		stack_limit = (void *)(attr._a_stackaddr - size);
 		/* Use application-provided stack for TLS only when
@@ -223,8 +223,8 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
 			guard = 0;
 		}
 	} else {
-		guard = ROUND(DEFAULT_GUARD_SIZE + attr._a_guardsize);
-		size = guard + ROUND(DEFAULT_STACK_SIZE + attr._a_stacksize
+		guard = ROUND(attr._a_guardsize);
+		size = guard + ROUND(attr._a_stacksize
 			+ libc.tls_size +  __pthread_tsd_size);
 	}