From 13bcc010e3a2bd11cac412a7a9866de50d59e74b Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Mon, 18 Jul 2022 16:28:30 +0300 Subject: [PATCH] lib: Return 0 as remaining msec if the thread is not scheduled Signed-off-by: Donatas Abraitis --- lib/thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/thread.c b/lib/thread.c index fd79503cc6..9c783808b5 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -756,6 +756,9 @@ unsigned long thread_timer_remain_msec(struct thread *thread) { int64_t remain; + if (!thread_is_scheduled(thread)) + return 0; + frr_with_mutex(&thread->mtx) { remain = monotime_until(&thread->u.sands, NULL) / 1000LL; } -- 2.39.5