1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-23 20:23:50 +01:00

Fix defer() thread safety issues on multi-core platforms (#9317)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2025-07-06 17:01:51 -05:00
committed by GitHub
parent 8da322fe9e
commit b6fade7339
13 changed files with 654 additions and 96 deletions

View File

@@ -14,12 +14,6 @@
#include <string>
#include <utility>
#include <vector>
#ifdef USE_ESP32
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <deque>
#include <atomic>
#endif
#if USE_WEBSERVER_VERSION >= 2
extern const uint8_t ESPHOME_WEBSERVER_INDEX_HTML[] PROGMEM;
@@ -504,7 +498,6 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
protected:
void add_sorting_info_(JsonObject &root, EntityBase *entity);
void schedule_(std::function<void()> &&f);
web_server_base::WebServerBase *base_;
#ifdef USE_ARDUINO
DeferredUpdateEventSourceList events_;
@@ -524,11 +517,6 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
const char *js_include_{nullptr};
#endif
bool expose_log_{true};
#ifdef USE_ESP32
std::deque<std::function<void()>> to_schedule_;
SemaphoreHandle_t to_schedule_lock_;
std::atomic<bool> to_schedule_has_items_{false};
#endif
};
} // namespace web_server