From df57b9014c07fbb3afdc33c1dc94c55c2dba0359 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 19 Dec 2019 08:06:53 +0800 Subject: [PATCH] Update thread.c --- src/thread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/thread.c b/src/thread.c index 95f9f76f8..041dfab87 100644 --- a/src/thread.c +++ b/src/thread.c @@ -543,6 +543,8 @@ rt_err_t rt_thread_delay_util(rt_tick_t *tick, rt_tick_t inc_tick) register rt_base_t level; struct rt_thread *thread; + RT_ASSERT(tick != RT_NULL); + /* set to current thread */ thread = rt_thread_self(); 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) rt_schedule(); - /* get the wakeup tick */ - *tick = rt_tick_get(); - /* clear error number of this thread to RT_EOK */ if (thread->error == -RT_ETIMEOUT) { @@ -581,6 +580,9 @@ rt_err_t rt_thread_delay_util(rt_tick_t *tick, rt_tick_t inc_tick) rt_hw_interrupt_enable(level); } + /* get the wakeup tick */ + *tick = rt_tick_get(); + return RT_EOK; } RTM_EXPORT(rt_thread_delay_util); -- GitLab