summaryrefslogtreecommitdiff
path: root/components/pthreads/pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/pthreads/pthread.c')
-rw-r--r--components/pthreads/pthread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/pthreads/pthread.c b/components/pthreads/pthread.c
index c779efed18..59a689a51e 100644
--- a/components/pthreads/pthread.c
+++ b/components/pthreads/pthread.c
@@ -180,10 +180,11 @@ int pthread_detach(pthread_t thread)
rt_enter_critical();
/* change to detach state */
ptd->attr.detachstate = PTHREAD_CREATE_DETACHED;
- rt_exit_critical();
/* detach joinable semaphore */
rt_sem_delete(ptd->joinable_sem);
+ ptd->joinable_sem = RT_NULL;
+ rt_exit_critical();
}
return 0;