diff --git a/src/ipc.c b/src/ipc.c index 111d724c2326f45fdcf4b1623dbbf5d44bcf5cce..22e0f06bc6c5f459329df19e383a740d600298b4 100755 --- a/src/ipc.c +++ b/src/ipc.c @@ -124,6 +124,7 @@ rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list, break; default: + RT_ASSERT(0); break; } diff --git a/src/thread.c b/src/thread.c index 34e96077d1a3f4fe653cb4df04932f0baf955c1e..e03c027eff82f348455c7e6ad447fe0fc2fad8b5 100644 --- a/src/thread.c +++ b/src/thread.c @@ -358,6 +358,8 @@ RTM_EXPORT(rt_thread_startup); */ rt_err_t rt_thread_detach(rt_thread_t thread) { + rt_base_t lock; + /* thread check */ RT_ASSERT(thread != RT_NULL); 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 */ rt_timer_detach(&(thread->thread_timer)); + /* disable interrupt */ + lock = rt_hw_interrupt_disable(); + /* change stat */ thread->stat = RT_THREAD_CLOSE; /* detach thread object */ rt_object_detach((rt_object_t)thread); + /* enable interrupt */ + rt_hw_interrupt_enable(lock); + return RT_EOK; } RTM_EXPORT(rt_thread_detach);