[update][kernel]规范rt_object_detach的使用
This commit is contained in:
parent
fae0fa8eea
commit
62137eec9a
13
src/thread.c
13
src/thread.c
|
@ -382,19 +382,8 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
||||||
/* change stat */
|
/* change stat */
|
||||||
thread->stat = RT_THREAD_CLOSE;
|
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);
|
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;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
|
||||||
/* enable interrupt */
|
/* enable interrupt */
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
|
|
||||||
rt_object_detach((rt_object_t)timer);
|
rt_object_detach(&(timer->parent));
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue