[update][kernel]规范rt_object_detach的使用

This commit is contained in:
张世争 2021-02-26 10:38:31 +08:00
parent fae0fa8eea
commit 62137eec9a
2 changed files with 3 additions and 14 deletions

View File

@ -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;
} }

View File

@ -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;
} }