summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorHubretXie <[email protected]>2019-11-26 09:30:21 +0800
committerGitHub <[email protected]>2019-11-26 09:30:21 +0800
commit17f7f1c7ca2581b2e308888f8acb99ca8a541422 (patch)
tree5236e93ab1e4e24508d4ebf4540b6743dd7c9a41 /src/thread.c
parent9662e18c3688681cd95ebd65242773dbe7c1366b (diff)
parente459084fe028c837762d40326a9be3dfdc179894 (diff)
Merge pull request #8 from RT-Thread/master
sync
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/thread.c b/src/thread.c
index ab203b1d49..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,
@@ -172,6 +172,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
/* lock init */
thread->scheduler_lock_nest = 0;
thread->cpus_lock_nest = 0;
+ thread->critical_lock_nest = 0;
#endif /*RT_USING_SMP*/
/* initialize cleanup function and user data */
@@ -445,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));