mirror of
https://github.com/esphome/esphome.git
synced 2025-08-10 12:27:46 +00:00
address bot review
This commit is contained in:
@@ -18,8 +18,12 @@ template<class T, uint8_t SIZE> class EventPool {
|
|||||||
~EventPool() {
|
~EventPool() {
|
||||||
// Clean up any remaining events in the free list
|
// Clean up any remaining events in the free list
|
||||||
T *event;
|
T *event;
|
||||||
|
RAMAllocator<T> allocator(RAMAllocator<T>::ALLOC_INTERNAL);
|
||||||
while ((event = this->free_list_.pop()) != nullptr) {
|
while ((event = this->free_list_.pop()) != nullptr) {
|
||||||
delete event;
|
// Call destructor
|
||||||
|
event->~T();
|
||||||
|
// Deallocate using RAMAllocator
|
||||||
|
allocator.deallocate(event, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,6 +94,9 @@ template<class T, uint8_t SIZE> class LockFreeQueue {
|
|||||||
return next_tail == head_.load(std::memory_order_acquire);
|
return next_tail == head_.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the FreeRTOS task handle to notify when items are pushed to the queue
|
||||||
|
// This enables efficient wake-up of a consumer task that's waiting for data
|
||||||
|
// @param task The FreeRTOS task handle to notify, or nullptr to disable notifications
|
||||||
void set_task_to_notify(TaskHandle_t task) { task_to_notify_ = task; }
|
void set_task_to_notify(TaskHandle_t task) { task_to_notify_ = task; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user