]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Return 0 as remaining msec if the thread is not scheduled
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 18 Jul 2022 13:28:30 +0000 (16:28 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 18 Jul 2022 13:43:44 +0000 (16:43 +0300)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
lib/thread.c

index fd79503cc6ac5ee3affd430a7f07411938af0309..9c783808b502c4b776aa903a6c16fb5072f473e2 100644 (file)
@@ -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;
        }