13#include "platforms/coroutine_runtime.h"
56 if (r && r->has_active_tasks()) {
67 total += r->active_task_count();
79 FL_WARN_ONCE(
"task::run re-entrancy detected, skipping nested call");
93 auto elapsed = [begin_time]() {
98 auto remaining = [elapsed, microseconds]() -> fl::u32 {
99 fl::u32 e = elapsed();
100 if (e >= microseconds) {
103 return microseconds - e;
107 auto expired = [remaining]() {
108 return remaining() == 0;
136 if (microseconds > 0) {
137 fl::platforms::ICoroutineRuntime::instance().pumpCoroutines(1000);
145 auto time_left = remaining();
147 fl::u32 sleep_us =
fl::min(1000u, time_left);
148 fl::platforms::ICoroutineRuntime::instance().pumpCoroutines(sleep_us);
151 }
while (!expired());
FastLED chrono implementation - duration types for time measurements.
static T & instance() FL_NOEXCEPT
static T & instance() FL_NOEXCEPT
fl::vector< Runner * > mRunners
bool has_active_tasks() const
Check if there are any active tasks.
void update_all()
Update all registered runners.
void register_runner(Runner *r)
Register a runner.
size_t total_active_tasks() const
Get total number of active tasks across all runners.
static Executor & instance()
void unregister_runner(Runner *r)
Unregister a runner.
Task executor (singleton) — manages registered runners.
Generic task runner interface.
static Scheduler & instance()
Task executor — runs registered task runners and manages the run loop.
Centralized logging categories for FastLED hardware interfaces and subsystems.
int & await_depth_tls()
Get reference to thread-local await recursion depth.
bool has_tasks()
Check if any systems have active tasks.
void run(fl::u32 microseconds, ExecFlags flags)
Run selected task subsystems.
size_t active_tasks()
Get the number of active tasks across all systems.
ExecFlags
Flags controlling which subsystems run() pumps.
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Iterator find(Iterator first, Iterator last, const T &value) FL_NOEXCEPT
scope_exit< decay_t< EF > > make_scope_exit(EF &&f)
Factory for C++11/14 (no CTAD).
fl::u32 micros()
Universal microsecond timer - returns microseconds since system startup.
void yield()
Yield to the platform scheduler.
Base definition for an LED controller.
RAII scope guard — executes a callable on scope exit.
Platform-aware cooperative yield for FastLED.