Merge pull request #4390 from zhangsz0516/zhangsz_0226
[update][kernel]规范rt_object_detach的使用
This commit is contained in:
commit
c8056dc7bb
13
src/thread.c
13
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)
|
||||
{
|
||||
/* detach thread object */
|
||||
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);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue