From 7aa2fd9f0ecc71097d6045426d2ed8aa49a5052e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 16 Jun 2025 15:19:10 +0200 Subject: [PATCH] ble pool --- esphome/components/esp32_ble/ble_event_pool.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/esp32_ble/ble_event_pool.h b/esphome/components/esp32_ble/ble_event_pool.h index 54ec3474c4..ef123b1325 100644 --- a/esphome/components/esp32_ble/ble_event_pool.h +++ b/esphome/components/esp32_ble/ble_event_pool.h @@ -15,7 +15,7 @@ namespace esp32_ble { // Events are allocated on first use and reused thereafter, growing to peak usage template class BLEEventPool { public: - BLEEventPool() { total_created_.store(0, std::memory_order_relaxed); } + BLEEventPool() : total_created_(0) {} ~BLEEventPool() { // Clean up any remaining events in the free list @@ -50,7 +50,7 @@ template class BLEEventPool { // Placement new to construct the object new (event) BLEEvent(); - this->total_created_.fetch_add(1, std::memory_order_relaxed); + this->total_created_++; return event; } @@ -63,7 +63,7 @@ template class BLEEventPool { private: LockFreeQueue free_list_; // Free events ready for reuse - std::atomic total_created_; // Total events created (high water mark) + uint8_t total_created_; // Total events created (high water mark) }; } // namespace esp32_ble