Skip to content

Commit 8c392f5

Browse files
Yaochengermysterywolf
authored andcommitted
[fix] 添加创建线程函数时间片参数检查 (#8807)
1 parent 1b25817 commit 8c392f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/thread.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
343343
/* parameter check */
344344
RT_ASSERT(thread != RT_NULL);
345345
RT_ASSERT(stack_start != RT_NULL);
346+
RT_ASSERT(tick != 0);
346347

347348
/* initialize thread object */
348349
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
@@ -512,6 +513,9 @@ rt_thread_t rt_thread_create(const char *name,
512513
rt_uint8_t priority,
513514
rt_uint32_t tick)
514515
{
516+
/* parameter check */
517+
RT_ASSERT(tick != 0);
518+
515519
struct rt_thread *thread;
516520
void *stack_start;
517521

0 commit comments

Comments
 (0)