From e7897eb9ccbccab6e1b94b63225044c039ba2fcd Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 13 Jan 2021 12:51:57 +0100 Subject: [PATCH] sched: stop dispatching timeouts on exit Check in the dispatch loop whether the need_to_exit flag was set. --- sched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sched.c b/sched.c index 8d91116..a4487c3 100644 --- a/sched.c +++ b/sched.c @@ -506,7 +506,7 @@ dispatch_timeouts(struct timespec *now) { n_entries_on_start = n_timer_queue_entries; n_done = 0; - while (1) { + do { LCL_ReadRawTime(now); if (!(n_timer_queue_entries > 0 && @@ -542,7 +542,8 @@ dispatch_timeouts(struct timespec *now) { n_done > 4 * MAX(n_timer_queue_entries, n_entries_on_start) && fabs(UTI_DiffTimespecsToDouble(now, &last_select_ts_raw)) / n_done < 0.01) LOG_FATAL("Possible infinite loop in scheduling"); - } + + } while (!need_to_exit); } /* ================================================== */