|
ESPHome 2026.12.0-dev
|
Type-erased scheduler callable, built from a callable at the call site: inline when small and trivially copyable, else heap-boxed. More...
#include <scheduler_callback.h>
Public Member Functions | |
| template<typename F > requires std::invocable<std::decay_t<F> &> | |
| SchedulerCallback (F &&f) | |
| SchedulerCallback (const SchedulerCallback &)=delete | |
| SchedulerCallback & | operator= (const SchedulerCallback &)=delete |
| ~SchedulerCallback () | |
Static Public Attributes | |
| static constexpr size_t | INLINE_WORDS = 3 |
| template<typename F > | |
| static constexpr bool | FITS_INLINE |
Type-erased scheduler callable, built from a callable at the call site: inline when small and trivially copyable, else heap-boxed.
A function taking SchedulerCallback && must pass it to the scheduler once, on every path: one that is dropped leaks its box and what it captured. A boxed capture's destructor runs with the scheduler lock held (as with std::function before), so it must not call the scheduler; the exception is a SCHEDULER_DONT_RUN callback, freed after the lock is released, which may reschedule its own key. Not Callback::create_boxed() (helpers.h): this keeps release inline and shares one ::operator delete for all trivially destructible boxes.
Definition at line 21 of file scheduler_callback.h.
|
inline |
Definition at line 31 of file scheduler_callback.h.
|
delete |
|
inline |
Definition at line 51 of file scheduler_callback.h.
|
delete |
| struct { ... } esphome::SchedulerCallback::boxed_ |
| unsigned char esphome::SchedulerCallback::bytes_[INLINE_WORDS *sizeof(uintptr_t)] |
Definition at line 92 of file scheduler_callback.h.
|
staticconstexpr |
Definition at line 26 of file scheduler_callback.h.
|
staticconstexpr |
Definition at line 23 of file scheduler_callback.h.
| void* esphome::SchedulerCallback::obj |
Definition at line 94 of file scheduler_callback.h.
| void(* esphome::SchedulerCallback::release) (void *obj) |
Definition at line 96 of file scheduler_callback.h.
| void(* esphome::SchedulerCallback::run) (void *obj) |
Definition at line 95 of file scheduler_callback.h.