From 31b3aeb48c5459fcf9e0e1760acba54b47463da0 Mon Sep 17 00:00:00 2001 From: JulianHolzwarth Date: Fri, 23 Aug 2019 15:56:41 +0200 Subject: [PATCH] sys/posix/pthread/pthread.c: Reaper fix before the reaper was never created --- sys/posix/pthread/pthread.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c index eeb553e219..59de182fd4 100644 --- a/sys/posix/pthread/pthread.c +++ b/sys/posix/pthread/pthread.c @@ -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; void *stack = autofree ? malloc(stack_size) : attr->ss_sp; 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); - if (pthread_reaper_pid != KERNEL_PID_UNDEF) { + if (pthread_reaper_pid == KERNEL_PID_UNDEF) { /* volatile pid to overcome problems with double checking */ volatile kernel_pid_t pid = thread_create(pthread_reaper_stack, PTHREAD_REAPER_STACKSIZE,