TC: more tolerate on the timeout tick in semaphore_dynamic
With system that has RT_TICK_PER_SECOND is 1000, it's easy to get one tick error.
This commit is contained in:
parent
46f9280a9d
commit
ac0e10bb83
|
@ -25,9 +25,13 @@ static void thread_entry(void* parameter)
|
|||
result = rt_sem_take(sem, 10);
|
||||
if (result == -RT_ETIMEOUT)
|
||||
{
|
||||
/* 判断是否刚好过去10个OS Tick */
|
||||
if (rt_tick_get() - tick != 10)
|
||||
rt_tick_t new_tick = rt_tick_get();
|
||||
/* 可以有两个 tick 的误差 */
|
||||
if (new_tick - tick >= 12)
|
||||
{
|
||||
rt_kprintf("tick error to large: expect: 10, get %d\n",
|
||||
new_tick - tick);
|
||||
|
||||
/* 如果失败,则测试失败 */
|
||||
tc_done(TC_STAT_FAILED);
|
||||
rt_sem_delete(sem);
|
||||
|
|
Loading…
Reference in New Issue