feat: add memset zero for rt_thread_init

`rt_object_allocate()` will clear memory after new rt_thread allocate in
`rt_thread_create()`. However, in `rt_thread_init()` the same behavior
is missing, which corrupt the consistence of the API.

Changes:
- Added `memset()` zero for `rt_thread_init()` in the entry

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell 2024-08-26 11:02:18 +08:00 committed by Meco Man
parent 82f30aa54f
commit cbf6b641c2
1 changed files with 3 additions and 0 deletions

View File

@ -334,6 +334,9 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
RT_ASSERT(stack_start != RT_NULL);
RT_ASSERT(tick != 0);
/* clean memory data of thread */
rt_memset(thread, 0x0, sizeof(struct rt_thread));
/* initialize thread object */
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);