summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.c3
1 files changed, 3 insertions, 0 deletions
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;
}