Skip to content

Commit df57b90

Browse files
authored
Update thread.c
1 parent 7a00b42 commit df57b90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/thread.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ rt_err_t rt_thread_delay_util(rt_tick_t *tick, rt_tick_t inc_tick)
543543
register rt_base_t level;
544544
struct rt_thread *thread;
545545

546+
RT_ASSERT(tick != RT_NULL);
547+
546548
/* set to current thread */
547549
thread = rt_thread_self();
548550
RT_ASSERT(thread != RT_NULL);
@@ -567,9 +569,6 @@ rt_err_t rt_thread_delay_util(rt_tick_t *tick, rt_tick_t inc_tick)
567569

568570
rt_schedule();
569571

570-
/* get the wakeup tick */
571-
*tick = rt_tick_get();
572-
573572
/* clear error number of this thread to RT_EOK */
574573
if (thread->error == -RT_ETIMEOUT)
575574
{
@@ -581,6 +580,9 @@ rt_err_t rt_thread_delay_util(rt_tick_t *tick, rt_tick_t inc_tick)
581580
rt_hw_interrupt_enable(level);
582581
}
583582

583+
/* get the wakeup tick */
584+
*tick = rt_tick_get();
585+
584586
return RT_EOK;
585587
}
586588
RTM_EXPORT(rt_thread_delay_util);

0 commit comments

Comments
 (0)