Skip to content

Commit 7327fb9

Browse files
committed
删除冗余,修复时钟溢出
1 parent 7f3794d commit 7327fb9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/timer.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,6 @@ static void _timer_check(rt_list_t *timer_list, struct rt_spinlock *lock)
494494

495495
level = rt_spin_lock_irqsave(lock);
496496

497-
current_tick = rt_tick_get();
498-
499497
rt_list_init(&list);
500498

501499
while (!rt_list_isempty(&timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1]))
@@ -762,7 +760,7 @@ void rt_timer_check(void)
762760
rt_tick_t next_timeout;
763761

764762
ret = _timer_list_next_timeout(_soft_timer_list, &next_timeout);
765-
if ((ret == RT_EOK) && (next_timeout <= rt_tick_get()))
763+
if ((ret == RT_EOK) && ((rt_tick_get() - next_timeout) < RT_TICK_MAX / 2))
766764
{
767765
rt_sem_release(&_soft_timer_sem);
768766
}

0 commit comments

Comments
 (0)