From e8b3a2f74b707529c70908c6afc97a486588ef30 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 19 Jan 2022 14:56:25 -0500 Subject: lib, zebra: Add ability to tell thread system to ignore late timers Add a thread_ignore_late_timer(struct thread *thread) function that allows thread.c to ignore when timers are late to the party. Signed-off-by: Donald Sharp --- lib/thread.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/thread.c') diff --git a/lib/thread.c b/lib/thread.c index 73e0e4887..376f61c24 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -787,6 +787,7 @@ static struct thread *thread_get(struct thread_master *m, uint8_t type, thread->arg = arg; thread->yield = THREAD_YIELD_TIME_SLOT; /* default */ thread->ref = NULL; + thread->ignore_timer_late = false; /* * So if the passed in funcname is not what we have @@ -1667,12 +1668,12 @@ static unsigned int thread_process_timers(struct thread_master *m, * really getting behind on handling of events. * Let's log it and do the right thing with it. */ - if (timercmp(timenow, &prev, >)) { - if (!displayed) - flog_warn( - EC_LIB_STARVE_THREAD, - "Thread Starvation: %pTHD was scheduled to pop greater than 4s ago", - thread); + if (!displayed && !thread->ignore_timer_late && + timercmp(timenow, &prev, >)) { + flog_warn( + EC_LIB_STARVE_THREAD, + "Thread Starvation: %pTHD was scheduled to pop greater than 4s ago", + thread); displayed = true; } -- cgit v1.2.3