From 52f76a4f4383019736eff08814dc1f7e9368d5df Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 1 Mar 2026 15:35:52 -1000 Subject: [PATCH] restore SYS_ARCH_UNPROTECT visibility comment --- esphome/core/lwip_fast_select.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/core/lwip_fast_select.h b/esphome/core/lwip_fast_select.h index f76eb47c8b..9e35a95dd6 100644 --- a/esphome/core/lwip_fast_select.h +++ b/esphome/core/lwip_fast_select.h @@ -43,7 +43,9 @@ struct lwip_sock *esphome_lwip_get_sock(int fd); static inline bool esphome_lwip_socket_has_data(struct lwip_sock *sock) { // Unlocked hint read — no lwIP core lock needed. // volatile prevents the compiler from caching/reordering this cross-thread read. - // Aligned 16-bit reads are single-instruction loads (L16SI/LH/LDRH) on + // The write side (TCP/IP thread) commits via SYS_ARCH_UNPROTECT which releases a + // FreeRTOS mutex (ESP32) or resumes the scheduler (LibreTiny), ensuring the value + // is visible. Aligned 16-bit reads are single-instruction loads (L16SI/LH/LDRH) on // Xtensa/RISC-V/ARM and cannot produce torn values. return *(volatile int16_t *) ((char *) sock + (int) ESPHOME_LWIP_SOCK_RCVEVENT_OFFSET) > 0; }