summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorarmink <[email protected]>2019-12-17 20:11:46 +0800
committerarmink <[email protected]>2019-12-17 20:11:46 +0800
commit4875ee8a3ab95c4fbf1e09941d3f44d99a9a632b (patch)
tree15c596c04a842bac747bbcf05a703b8da76f8eac /src/thread.c
parentfa46d6ac861f26b472d62abdf1278c445431ce4c (diff)
Sync from master (75a3f3dd3a930eab1dc58fa0258a9d1605a0ac11)
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/thread.c b/src/thread.c
index 940d24e6f2..db79f640b5 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -142,7 +142,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
(void *)rt_thread_exit);
#else
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
- (void *)((char *)thread->stack_addr + thread->stack_size - 4),
+ (rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
(void *)rt_thread_exit);
#endif
@@ -169,7 +169,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
thread->cleanup = 0;
thread->user_data = 0;
- /* init thread timer */
+ /* initialize thread timer */
rt_timer_init(&(thread->thread_timer),
thread->name,
rt_thread_timeout,
@@ -230,7 +230,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
RT_ASSERT(thread != RT_NULL);
RT_ASSERT(stack_start != RT_NULL);
- /* init thread object */
+ /* initialize thread object */
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
return _rt_thread_init(thread,
@@ -269,7 +269,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
RT_ASSERT((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_INIT);
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
- /* set current priority to init priority */
+ /* set current priority to initialize priority */
thread->current_priority = thread->init_priority;
/* calculate priority attribute */
@@ -422,12 +422,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));