diff --git a/src/thread/default_attr.c b/src/thread/default_attr.c new file mode 100644 index 00000000..46fe98ee --- /dev/null +++ b/src/thread/default_attr.c @@ -0,0 +1,4 @@ +#include "pthread_impl.h" + +size_t __default_stacksize = DEFAULT_STACK_SIZE; +size_t __default_guardsize = DEFAULT_GUARD_SIZE; diff --git a/src/thread/pthread_attr_init.c b/src/thread/pthread_attr_init.c index 8f6e3374..a962b460 100644 --- a/src/thread/pthread_attr_init.c +++ b/src/thread/pthread_attr_init.c @@ -1,9 +1,12 @@ #include "pthread_impl.h" +extern size_t __default_stacksize; +extern size_t __default_guardsize; + int pthread_attr_init(pthread_attr_t *a) { *a = (pthread_attr_t){0}; - a->_a_stacksize = DEFAULT_STACK_SIZE; - a->_a_guardsize = DEFAULT_GUARD_SIZE; + a->_a_stacksize = __default_stacksize; + a->_a_guardsize = __default_guardsize; return 0; } diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 2c066cff..2df2e9f9 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -165,8 +165,8 @@ static void *dummy_tsd[1] = { 0 }; weak_alias(dummy_tsd, __pthread_tsd_main); volatile int __block_new_threads = 0; -size_t __default_stacksize = DEFAULT_STACK_SIZE; -size_t __default_guardsize = DEFAULT_GUARD_SIZE; +extern size_t __default_stacksize; +extern size_t __default_guardsize; static FILE *volatile dummy_file = 0; weak_alias(dummy_file, __stdin_used);