From cdaf8c65cabd0120e6d19453cfffe905e9b6a769 Mon Sep 17 00:00:00 2001 From: shaojinchun Date: Tue, 12 Nov 2019 16:02:24 +0800 Subject: 修正rt_thread_delete在特定点被切走后不能回来继续执行的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index a88729e52c..bee5f0c2c0 100644 --- a/src/thread.c +++ b/src/thread.c @@ -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)); -- cgit v1.3.1 From 88b552276b1b64750f3db460b36f8e329f1c18c4 Mon Sep 17 00:00:00 2001 From: shaojinchun Date: Fri, 15 Nov 2019 10:45:12 +0800 Subject: 修正在多核时,运行在另外核上的idle任务有可能会插在rt_thread_exit调用rt_schedule之前释放其资源的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index bee5f0c2c0..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, -- cgit v1.3.1