summaryrefslogtreecommitdiff
path: root/lib/thread.c
diff options
context:
space:
mode:
authorSri Mohana Singamsetty <srimohans@gmail.com>2022-02-25 08:05:45 -0800
committerGitHub <noreply@github.com>2022-02-25 08:05:45 -0800
commit787bd3ba6c960a073b94d99764b12c687b32e45a (patch)
tree597ebb5a7ff51609a0b7a444b9001ad122914169 /lib/thread.c
parent41ff140670e1c1a0cfbea682000a1cfe3a0cc1a0 (diff)
parente2eff5c3b13ee31ddc1b80d828ce12fba64f6a3b (diff)
Merge pull request #10655 from donaldsharp/timers_warning_when_large
lib: Add a Dev catch for when a timer is set for > 1 year
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 58b8e206fa..bc3bfe89d4 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1052,6 +1052,12 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref,
if (thread_timer_list_first(&m->timer) == thread)
AWAKEN(m);
}
+#define ONEYEAR2SEC (60 * 60 * 24 * 365)
+ if (time_relative->tv_sec > ONEYEAR2SEC)
+ flog_err(
+ EC_LIB_TIMER_TOO_LONG,
+ "Timer: %pTHD is created with an expiration that is greater than 1 year",
+ thread);
}