From 5446609ae9cae0f5e4a68662bdbb11dabc0959f1 Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Mon, 9 Aug 2021 11:53:14 +0800 Subject: [PATCH] timeout: Add function for deinit system timers Picked from espressif/esp-lwip@2749568f Ref IDF-4847 --- src/core/timeouts.c | 9 +++++++++ src/include/lwip/timeouts.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/core/timeouts.c b/src/core/timeouts.c index 34aad13a..a06f8028 100644 --- a/src/core/timeouts.c +++ b/src/core/timeouts.c @@ -272,6 +272,15 @@ void sys_timeouts_init(void) } } +/** Deinitialize this module */ +void sys_timeouts_deinit(void) +{ + size_t i; + /* tcp_tmr() at index 0 is started on demand */ + for (i = (LWIP_TCP ? 1 : 0); i < LWIP_ARRAYSIZE(lwip_cyclic_timers); i++) { + sys_untimeout(lwip_cyclic_timer, LWIP_CONST_CAST(void *, &lwip_cyclic_timers[i])); + } +} /** * Create a one-shot timer (aka timeout). Timeouts are processed in the * following cases: diff --git a/src/include/lwip/timeouts.h b/src/include/lwip/timeouts.h index b601f9eb..1791f54c 100644 --- a/src/include/lwip/timeouts.h +++ b/src/include/lwip/timeouts.h @@ -101,6 +101,7 @@ struct sys_timeo { }; void sys_timeouts_init(void); +void sys_timeouts_deinit(void); #if LWIP_DEBUG_TIMERNAMES void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name);