sys/posix/pthread/pthread.c: Reaper fix
before the reaper was never created
This commit is contained in:
parent
7a818f0433
commit
31b3aeb48c
@ -135,10 +135,9 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
|
|||||||
size_t stack_size = attr && attr->ss_size > 0 ? attr->ss_size : PTHREAD_STACKSIZE;
|
size_t stack_size = attr && attr->ss_size > 0 ? attr->ss_size : PTHREAD_STACKSIZE;
|
||||||
void *stack = autofree ? malloc(stack_size) : attr->ss_sp;
|
void *stack = autofree ? malloc(stack_size) : attr->ss_sp;
|
||||||
pt->stack = autofree ? stack : NULL;
|
pt->stack = autofree ? stack : NULL;
|
||||||
|
if (autofree && pthread_reaper_pid == KERNEL_PID_UNDEF) {
|
||||||
if (autofree && pthread_reaper_pid != KERNEL_PID_UNDEF) {
|
|
||||||
mutex_lock(&pthread_mutex);
|
mutex_lock(&pthread_mutex);
|
||||||
if (pthread_reaper_pid != KERNEL_PID_UNDEF) {
|
if (pthread_reaper_pid == KERNEL_PID_UNDEF) {
|
||||||
/* volatile pid to overcome problems with double checking */
|
/* volatile pid to overcome problems with double checking */
|
||||||
volatile kernel_pid_t pid = thread_create(pthread_reaper_stack,
|
volatile kernel_pid_t pid = thread_create(pthread_reaper_stack,
|
||||||
PTHREAD_REAPER_STACKSIZE,
|
PTHREAD_REAPER_STACKSIZE,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user