Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d47771f

Browse files
mathieucarboupre-commit-ci-lite[bot]
andauthored
fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set (#10529)
* fix(sntp): Lock / Unlock LWIP if CONFIG_LWIP_TCPIP_CORE_LOCKING is set Fixes: #10526 * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 74e4a74 commit d47771f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

‎cores/esp32/esp32-hal-time.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
//#include "tcpip_adapter.h"
1818
#include "esp_netif.h"
1919

20+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
21+
#include "lwip/priv/tcpip_priv.h"
22+
#endif
23+
2024
static void setTimeZone(long offset, int daylight) {
2125
char cst[17] = {0};
2226
char cdt[17] = "DST";
@@ -50,11 +54,25 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char *server1,
5054
if (sntp_enabled()) {
5155
sntp_stop();
5256
}
57+
58+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
59+
if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
60+
LOCK_TCPIP_CORE();
61+
}
62+
#endif
63+
5364
sntp_setoperatingmode(SNTP_OPMODE_POLL);
5465
sntp_setservername(0, (char *)server1);
5566
sntp_setservername(1, (char *)server2);
5667
sntp_setservername(2, (char *)server3);
5768
sntp_init();
69+
70+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
71+
if (sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
72+
UNLOCK_TCPIP_CORE();
73+
}
74+
#endif
75+
5876
setTimeZone(-gmtOffset_sec, daylightOffset_sec);
5977
}
6078

@@ -68,11 +86,25 @@ void configTzTime(const char *tz, const char *server1, const char *server2, cons
6886
if (sntp_enabled()) {
6987
sntp_stop();
7088
}
89+
90+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
91+
if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
92+
LOCK_TCPIP_CORE();
93+
}
94+
#endif
95+
7196
sntp_setoperatingmode(SNTP_OPMODE_POLL);
7297
sntp_setservername(0, (char *)server1);
7398
sntp_setservername(1, (char *)server2);
7499
sntp_setservername(2, (char *)server3);
75100
sntp_init();
101+
102+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
103+
if (sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) {
104+
UNLOCK_TCPIP_CORE();
105+
}
106+
#endif
107+
76108
setenv("TZ", tz, 1);
77109
tzset();
78110
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /