From 33ce920857405d4f4b342c85b74588a15e2702e5 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 7 Nov 2016 20:47:24 -0500 Subject: 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. --- src/thread/pthread_attr_get.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/thread/pthread_attr_get.c') diff --git a/src/thread/pthread_attr_get.c b/src/thread/pthread_attr_get.c index 3d296bf3..4aa5afdb 100644 --- a/src/thread/pthread_attr_get.c +++ b/src/thread/pthread_attr_get.c @@ -7,7 +7,7 @@ int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state) } int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) { - *size = a->_a_guardsize + DEFAULT_GUARD_SIZE; + *size = a->_a_guardsize; return 0; } @@ -39,14 +39,14 @@ int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr { if (!a->_a_stackaddr) return EINVAL; - *size = a->_a_stacksize + DEFAULT_STACK_SIZE; + *size = a->_a_stacksize; *addr = (void *)(a->_a_stackaddr - *size); return 0; } int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) { - *size = a->_a_stacksize + DEFAULT_STACK_SIZE; + *size = a->_a_stacksize; return 0; } -- cgit v1.2.1