J. Nick Koston 33bef13900 [scheduler] Reduce lock acquisitions in process_defer_queue_
Restructure the defer queue processing loop to merge lock acquisitions.
Previously each item required two separate lock/unlock pairs: one to
move the item out of the queue, and one to recycle it after execution.
This totaled 2N+1 lock acquisitions for N items.

By combining the recycle of each item with the move-out of the next
item under a single lock hold, the total drops to N+1. The callback
still executes without the lock held to prevent deadlocks.

Also adds an early return when the queue is empty to avoid taking
the lock at all in the common case (nothing deferred). The lockless
check is safe because the main loop is the single consumer of
defer_queue_front_, and a stale size() read from a concurrent push
can only cause us to see fewer items — they will be processed on
the next loop iteration.

Additionally outlines the rare defer queue compaction path into a
separate noinline compact_defer_queue_locked_() to keep cold code
out of the hot instruction cache lines.
2026-02-19 10:19:41 -06:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2025-12-21 09:26:03 -05:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2025-12-08 14:37:45 -05:00
2026-02-12 23:04:19 +13:00
2025-07-17 22:40:28 +12:00
2026-02-11 22:11:48 -05:00
2025-12-05 08:48:04 -05:00
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses 524 MiB
Languages
C++ 64.1%
Python 35.5%
C 0.3%