mirror of
https://github.com/esphome/esphome.git
synced 2026-09-01 02:26:01 +00:00
[api] Clarify fence comment per review
Plain non-atomic load on the fast path is not a 'relaxed load' in the C++ atomic sense; describe what the fence accomplishes instead.
This commit is contained in:
@@ -571,10 +571,11 @@ inline ESPHOME_ALWAYS_INLINE Application::ComponentPhaseGuard::ComponentPhaseGua
|
||||
inline void ESPHOME_ALWAYS_INLINE Application::loop() {
|
||||
#if defined(USE_LWIP_FAST_SELECT) && defined(ESPHOME_THREAD_MULTI_ATOMICS)
|
||||
// Pairs with the TCP/IP thread's SYS_ARCH_UNPROTECT release on rcvevent so
|
||||
// every Socket::ready() in this iter uses a relaxed load (no per-call memw).
|
||||
// Wake is independent (xTaskNotifyGive/ulTaskNotifyTake), so non-losing.
|
||||
// Skipped on MULTI_NO_ATOMICS (e.g. BK72xx) — that path keeps `volatile` in
|
||||
// esphome_lwip_socket_has_data() instead.
|
||||
// subsequent Socket::ready() checks in this iter observe the published state
|
||||
// without a per-call memw. Wake is independent (xTaskNotifyGive/
|
||||
// ulTaskNotifyTake), so non-losing. Skipped on MULTI_NO_ATOMICS (e.g.
|
||||
// BK72xx) — that path keeps `volatile` in esphome_lwip_socket_has_data()
|
||||
// instead.
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
#endif
|
||||
#ifdef USE_RUNTIME_STATS
|
||||
|
||||
Reference in New Issue
Block a user