summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorbernard <[email protected]>2017-09-29 10:23:56 +0800
committerbernard <[email protected]>2017-09-29 10:23:56 +0800
commitcccff34fcac04f34233a33e453f2d0ec255bf231 (patch)
treed406036f73296b27f3cb96e77ede98dd7803c61d /src/thread.c
parente9a77b513f0a4b37d539a030592a61b08d03602d (diff)
parent3691b67e83ab57196dfc62606b1be18db76994a7 (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/thread.c b/src/thread.c
index 4f7e070e02..0048261e96 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -55,7 +55,7 @@ static void (*rt_thread_inited_hook) (rt_thread_t thread);
/**
* @ingroup Hook
- * This function sets a hook function when the system suspend a thread.
+ * This function sets a hook function when the system suspend a thread.
*
* @param hook the specified hook function
*
@@ -68,7 +68,7 @@ void rt_thread_suspend_sethook(void (*hook)(rt_thread_t thread))
/**
* @ingroup Hook
- * This function sets a hook function when the system resume a thread.
+ * This function sets a hook function when the system resume a thread.
*
* @param hook the specified hook function
*
@@ -81,13 +81,13 @@ void rt_thread_resume_sethook(void (*hook)(rt_thread_t thread))
/**
* @ingroup Hook
- * This function sets a hook function when a thread is initialized.
+ * This function sets a hook function when a thread is initialized.
*
* @param hook the specified hook function
*/
void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
{
- rt_thread_inited_hook = hook;
+ rt_thread_inited_hook = hook;
}
#endif
@@ -151,14 +151,20 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
/* init thread stack */
rt_memset(thread->stack_addr, '#', thread->stack_size);
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
- (void *)((char *)thread->stack_addr + thread->stack_size - 4),
- (void *)rt_thread_exit);
+ (void *)((char *)thread->stack_addr + thread->stack_size - 4),
+ (void *)rt_thread_exit);
/* priority init */
RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX);
thread->init_priority = priority;
thread->current_priority = priority;
+ thread->number_mask = 0;
+#if RT_THREAD_PRIORITY_MAX > 32
+ thread->number = 0;
+ thread->high_mask = 0;
+#endif
+
/* tick init */
thread->init_tick = tick;
thread->remaining_tick = tick;
@@ -179,7 +185,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
0,
RT_TIMER_FLAG_ONE_SHOT);
- RT_OBJECT_HOOK_CALL(rt_thread_inited_hook,(thread));
+ RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
return RT_EOK;
}
@@ -637,7 +643,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
/* enable interrupt */
rt_hw_interrupt_enable(temp);
- RT_OBJECT_HOOK_CALL(rt_thread_suspend_hook,(thread));
+ RT_OBJECT_HOOK_CALL(rt_thread_suspend_hook, (thread));
return RT_EOK;
}
RTM_EXPORT(rt_thread_suspend);
@@ -680,7 +686,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
/* insert to schedule ready list */
rt_schedule_insert_thread(thread);
- RT_OBJECT_HOOK_CALL(rt_thread_resume_hook,(thread));
+ RT_OBJECT_HOOK_CALL(rt_thread_resume_hook, (thread));
return RT_EOK;
}
RTM_EXPORT(rt_thread_resume);