diff --git a/src/thread.c b/src/thread.c index 2681eca59f..18b5227f5a 100644 --- a/src/thread.c +++ b/src/thread.c @@ -382,19 +382,8 @@ rt_err_t rt_thread_detach(rt_thread_t thread) /* change stat */ thread->stat = RT_THREAD_CLOSE; - if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) - { - rt_object_detach((rt_object_t)thread); - } - else - { - /* disable interrupt */ - lock = rt_hw_interrupt_disable(); - /* insert to defunct thread list */ - rt_list_insert_after(&rt_thread_defunct, &(thread->tlist)); - /* enable interrupt */ - rt_hw_interrupt_enable(lock); - } + /* detach thread object */ + rt_object_detach((rt_object_t)thread); return RT_EOK; } diff --git a/src/timer.c b/src/timer.c index d882711151..747c28c8bd 100644 --- a/src/timer.c +++ b/src/timer.c @@ -233,7 +233,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer) /* enable interrupt */ rt_hw_interrupt_enable(level); - rt_object_detach((rt_object_t)timer); + rt_object_detach(&(timer->parent)); return RT_EOK; }