diff --git a/src/avr/timer.c b/src/avr/timer.c index e40007d8..dcd01869 100644 --- a/src/avr/timer.c +++ b/src/avr/timer.c @@ -195,7 +195,7 @@ ISR(TIMER1_COMPA_vect) irq_disable(); uint16_t now = timer_get(); if ((int16_t)(next - now) < (int16_t)(-timer_from_us(1000))) - shutdown("Rescheduled timer in the past"); + try_shutdown("Rescheduled timer in the past"); if (sched_tasks_busy()) { timer_repeat_set(now + TIMER_REPEAT_TICKS); next = now + TIMER_DEFER_REPEAT_TICKS; diff --git a/src/generic/timer_irq.c b/src/generic/timer_irq.c index 6527c949..0b4c3c8d 100644 --- a/src/generic/timer_irq.c +++ b/src/generic/timer_irq.c @@ -54,7 +54,7 @@ timer_dispatch_many(void) if (unlikely(timer_is_before(tru, now))) { // Check if there are too many repeat timers if (diff < (int32_t)(-timer_from_us(1000))) - shutdown("Rescheduled timer in the past"); + try_shutdown("Rescheduled timer in the past"); if (sched_tasks_busy()) { timer_repeat_until = now + TIMER_REPEAT_TICKS; return now + TIMER_DEFER_REPEAT_TICKS; diff --git a/src/linux/timer.c b/src/linux/timer.c index 016f3da3..d53dd7da 100644 --- a/src/linux/timer.c +++ b/src/linux/timer.c @@ -166,9 +166,8 @@ timer_dispatch(void) if (unlikely(timespec_is_before(tru, now))) { // Check if there are too many repeat timers - if (unlikely(timespec_is_before(timespec_add(nt, 100000000), now)) - && !sched_is_shutdown()) - shutdown("Rescheduled timer in the past"); + if (unlikely(timespec_is_before(timespec_add(nt, 100000000), now))) + try_shutdown("Rescheduled timer in the past"); if (sched_tasks_busy()) { timer_repeat_until = timespec_add(now, TIMER_REPEAT_NS); next_wake_time = timespec_add(now, TIMER_DEFER_REPEAT_NS); diff --git a/src/sched.c b/src/sched.c index e4b51355..f278c426 100644 --- a/src/sched.c +++ b/src/sched.c @@ -306,7 +306,7 @@ sched_report_shutdown(void) void sched_try_shutdown(uint_fast8_t reason) { - if (shutdown_status != 2) + if (!shutdown_status) sched_shutdown(reason); }