Update thread.c

This commit is contained in:
Bernard Xiong 2019-12-19 08:06:53 +08:00 committed by GitHub
parent 7a00b42e97
commit df57b9014c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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);