diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c index cbd237c6328f..eeb553e219a8 100644 --- a/sys/posix/pthread/pthread.c +++ b/sys/posix/pthread/pthread.c @@ -87,7 +87,7 @@ static void *pthread_start_routine(void *pt_) static int insert(pthread_thread_t *pt) { - int result = -1; + int result = KERNEL_PID_UNDEF; mutex_lock(&pthread_mutex); for (int i = 0; i < MAXTHREADS; i++){ @@ -160,7 +160,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta pthread_start_routine, pt, "pthread"); - if (pt->thread_pid == KERNEL_PID_UNDEF) { + if (!pid_is_valid(pt->thread_pid)) { free(pt->stack); free(pt); pthread_sched_threads[pthread_pid-1] = NULL;