diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-07-18 16:28:30 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-07-18 16:43:44 +0300 |
| commit | 13bcc010e3a2bd11cac412a7a9866de50d59e74b (patch) | |
| tree | 9addbef43690269ae971a96f8e8789a5ee6b0ba9 /lib/thread.c | |
| parent | 5f5b29862f4cd82c035badb7aefc55e08c38910b (diff) | |
lib: Return 0 as remaining msec if the thread is not scheduled
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/thread.c')
| -rw-r--r-- | lib/thread.c | 3 |
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; } |
