mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-31 12:40:27 +08:00
[Kernel] Fix double release for thread
Signed-off-by: Cliff Chen <cliff.chen@rock-chips.com>
This commit is contained in:
parent
4ef35a9dee
commit
240961e8e8
@ -338,6 +338,9 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
|||||||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||||
RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread));
|
RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread));
|
||||||
|
|
||||||
|
if (thread->stat == RT_THREAD_CLOSE)
|
||||||
|
return RT_EOK;
|
||||||
|
|
||||||
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT)
|
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT)
|
||||||
{
|
{
|
||||||
/* remove from schedule */
|
/* remove from schedule */
|
||||||
@ -437,6 +440,9 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
|
|||||||
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
|
||||||
RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread) == RT_FALSE);
|
RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread) == RT_FALSE);
|
||||||
|
|
||||||
|
if (thread->stat == RT_THREAD_CLOSE)
|
||||||
|
return RT_EOK;
|
||||||
|
|
||||||
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT)
|
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT)
|
||||||
{
|
{
|
||||||
/* remove from schedule */
|
/* remove from schedule */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user