Merge pull request #4390 from zhangsz0516/zhangsz_0226

[update][kernel]规范rt_object_detach的使用
This commit is contained in:
Bernard Xiong 2021-02-26 12:55:44 +08:00 committed by GitHub
commit c8056dc7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 */
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;
}

View File

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