Skip to content

Commit 10a6827

Browse files
Sliverguoguodi
authored and
guodi
committed
[Fix bug] fix thread init bug
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.
1 parent c924330 commit 10a6827

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/thread.c

100644100755
+13
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
151151
thread->current_priority = priority;
152152

153153
thread->number_mask = 0;
154+
155+
#ifdef RT_USING_EVENT
156+
thread->event_set = 0;
157+
thread->event_info = 0;
158+
#endif
159+
154160
#if RT_THREAD_PRIORITY_MAX > 32
155161
thread->number = 0;
156162
thread->high_mask = 0;
@@ -203,6 +209,13 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
203209
thread->lwp = RT_NULL;
204210
#endif
205211

212+
213+
#ifdef RT_USING_MODULE
214+
thread->module_id = 0;
215+
#endif
216+
217+
thread->user_data = 0;
218+
206219
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
207220

208221
return RT_EOK;

0 commit comments

Comments
 (0)