未验证 提交 01b3a34c 编写于 作者: C Chester guo 提交者: GitHub

[Fix bug] fix thread init bug (#4891)

When we create thread A by rt_thread_init but do
    not init the thread object,and then create thread
    B in the thread A,it maybe crash.
上级 49ccbdb8
......@@ -191,6 +191,12 @@ static rt_err_t _thread_init(struct rt_thread *thread,
thread->current_priority = priority;
thread->number_mask = 0;
#ifdef RT_USING_EVENT
thread->event_set = 0;
thread->event_info = 0;
#endif
#if RT_THREAD_PRIORITY_MAX > 32
thread->number = 0;
thread->high_mask = 0;
......@@ -247,6 +253,13 @@ static rt_err_t _thread_init(struct rt_thread *thread,
thread->duration_tick = 0;
#endif
#ifdef RT_USING_MODULE
thread->module_id = 0;
#endif
thread->user_data = 0;
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
return RT_EOK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册