summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorchengxiaohu <[email protected]>2019-11-20 23:38:35 +0800
committerchengxiaohu <[email protected]>2019-11-20 23:38:35 +0800
commit6b8a3469f8cb69d9ee49487c524533a9516ebce1 (patch)
tree9b51157878a815b6da9d8d691ac0bbdbb2bc1f64 /src/thread.c
parent2a512f3df0f39790a14f1984c42a97dc0a82ba09 (diff)
parent1bf5f67e8a6c9672945d3b0a61e173ce0b6e56d3 (diff)
Merge branch 'master' of https://github.com/chengxiaohu/rt-thread
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/thread.c b/src/thread.c
index a88729e52c..c5f75a1176 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -107,11 +107,11 @@ void rt_thread_exit(void)
rt_list_insert_after(&rt_thread_defunct, &(thread->tlist));
}
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
-
/* switch to next task */
rt_schedule();
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
}
static rt_err_t _rt_thread_init(struct rt_thread *thread,
@@ -446,12 +446,12 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
/* release thread timer */
rt_timer_detach(&(thread->thread_timer));
- /* change stat */
- thread->stat = RT_THREAD_CLOSE;
-
/* disable interrupt */
lock = rt_hw_interrupt_disable();
+ /* change stat */
+ thread->stat = RT_THREAD_CLOSE;
+
/* insert to defunct thread list */
rt_list_insert_after(&rt_thread_defunct, &(thread->tlist));