diff options
| author | Bernard Xiong <[email protected]> | 2019-12-19 08:06:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-12-19 08:06:53 +0800 |
| commit | df57b9014c07fbb3afdc33c1dc94c55c2dba0359 (patch) | |
| tree | d3ef3e28d87e8d70e5073ea0d392e3995f0d280b /src/thread.c | |
| parent | 7a00b42e9764a3a51095f7a810344405ce190f75 (diff) | |
Update thread.c
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/thread.c b/src/thread.c index 95f9f76f84..041dfab879 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); |
