mirror of
https://github.com/esphome/esphome.git
synced 2025-09-04 04:12:23 +01:00
[scheduler] Fix LibreTiny compilation error due to missing atomic operations (#9643)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#if !defined(USE_ESP8266) && !defined(USE_RP2040)
|
||||
#if !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY)
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
@@ -211,11 +211,11 @@ class Scheduler {
|
||||
// Both platforms save 40 bytes of RAM by excluding this
|
||||
std::deque<std::unique_ptr<SchedulerItem>> defer_queue_; // FIFO queue for defer() calls
|
||||
#endif
|
||||
#if !defined(USE_ESP8266) && !defined(USE_RP2040)
|
||||
// Multi-threaded platforms: last_millis_ needs atomic for lock-free updates
|
||||
#if !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY)
|
||||
// Multi-threaded platforms with atomic support: last_millis_ needs atomic for lock-free updates
|
||||
std::atomic<uint32_t> last_millis_{0};
|
||||
#else
|
||||
// Single-threaded platforms: no atomics needed
|
||||
// Platforms without atomic support or single-threaded platforms
|
||||
uint32_t last_millis_{0};
|
||||
#endif
|
||||
// millis_major_ is protected by lock when incrementing, volatile ensures
|
||||
|
Reference in New Issue
Block a user