Merge pull request #4738 from enkiller/0528-1028
[kernel] Improve kernel stability
This commit is contained in:
commit
06927af8f1
|
@ -124,6 +124,7 @@ rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
RT_ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,8 @@ RTM_EXPORT(rt_thread_startup);
|
||||||
*/
|
*/
|
||||||
rt_err_t rt_thread_detach(rt_thread_t thread)
|
rt_err_t rt_thread_detach(rt_thread_t thread)
|
||||||
{
|
{
|
||||||
|
rt_base_t lock;
|
||||||
|
|
||||||
/* thread check */
|
/* thread check */
|
||||||
RT_ASSERT(thread != RT_NULL);
|
RT_ASSERT(thread != RT_NULL);
|
||||||
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);
|
||||||
|
@ -377,12 +379,18 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
|
||||||
/* release thread timer */
|
/* release thread timer */
|
||||||
rt_timer_detach(&(thread->thread_timer));
|
rt_timer_detach(&(thread->thread_timer));
|
||||||
|
|
||||||
|
/* disable interrupt */
|
||||||
|
lock = rt_hw_interrupt_disable();
|
||||||
|
|
||||||
/* change stat */
|
/* change stat */
|
||||||
thread->stat = RT_THREAD_CLOSE;
|
thread->stat = RT_THREAD_CLOSE;
|
||||||
|
|
||||||
/* detach thread object */
|
/* detach thread object */
|
||||||
rt_object_detach((rt_object_t)thread);
|
rt_object_detach((rt_object_t)thread);
|
||||||
|
|
||||||
|
/* enable interrupt */
|
||||||
|
rt_hw_interrupt_enable(lock);
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_thread_detach);
|
RTM_EXPORT(rt_thread_detach);
|
||||||
|
|
Loading…
Reference in New Issue