[core] wakeable_delay: yield on already-woken fast path (ESP8266, RP2040) (#16045)
This commit is contained in:
1 parent
52e8c50f45
commit
daf3f4d2f1
2 files changed
+8
No files matched your search
@@ -36,6 +36,10 @@ inline void ESPHOME_ALWAYS_INLINE wakeable_delay(uint32_t ms) {
|
||||
}
|
||||
if (g_main_loop_woke) {
|
||||
g_main_loop_woke = false;
|
||||
// Yield even on the already-woken fast path so callers in tight loops
|
||||
// (e.g. lwIP raw TCP wait_for_data_) make forward progress when ISRs
|
||||
// keep re-setting g_main_loop_woke between iterations.
|
||||
delay(0);
|
||||
return;
|
||||
}
|
||||
esp_delay(ms, []() { return !g_main_loop_woke; });
|
||||
|
||||
@@ -36,6 +36,10 @@ void wakeable_delay(uint32_t ms) {
|
||||
}
|
||||
if (g_main_loop_woke) {
|
||||
g_main_loop_woke = false;
|
||||
// Yield even on the already-woken fast path so callers in tight loops
|
||||
// (e.g. lwIP raw TCP wait_for_data_) make forward progress when async
|
||||
// wakes keep re-setting g_main_loop_woke between iterations.
|
||||
yield();
|
||||
return;
|
||||
}
|
||||
s_delay_expired = false;
|
||||
|
||||
Reference in new issue
Block a user