diff --git a/src/system/libroot/posix/pthread/pthread.cpp b/src/system/libroot/posix/pthread/pthread.cpp index 4c5104a..71e5eca 100644 --- a/src/system/libroot/posix/pthread/pthread.cpp +++ b/src/system/libroot/posix/pthread/pthread.cpp @@ -191,6 +191,9 @@ pthread_join(pthread_t thread, void** _value) if (_value != NULL) *_value = thread->exit_value; + + if(thread->flags & THREAD_DETACHED) + return EINVAL;; if ((atomic_or(&thread->flags, THREAD_DETACHED) & THREAD_DEAD) != 0) free(thread);