mirror of
https://github.com/fluencelabs/musl
synced 2025-06-29 14:42:01 +00:00
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.
10 lines
234 B
C
10 lines
234 B
C
#include "pthread_impl.h"
|
|
|
|
int pthread_attr_setstack(pthread_attr_t *a, void *addr, size_t size)
|
|
{
|
|
if (size-PTHREAD_STACK_MIN > SIZE_MAX/4) return EINVAL;
|
|
a->_a_stackaddr = (size_t)addr + size;
|
|
a->_a_stacksize = size;
|
|
return 0;
|
|
}
|