50#include "platforms/await.h"
70 ALL = (1 << 0) | (1 << 1) | (1 << 2)
74 return static_cast<ExecFlags>(
static_cast<u8>(a) |
static_cast<u8>(b));
78 return (
static_cast<u8>(a) &
static_cast<u8>(b)) != 0;
203 if (await_depth > 10) {
211 const int max_pump_iterations = 10000;
213 while (!p.
is_completed() && pump_count < max_pump_iterations) {
231 if (pump_count >= max_pump_iterations) {
306 return fl::platforms::await(p);
fl::vector< Runner * > mRunners
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.
bool is_completed() const FL_NOEXCEPT
Check if Promise is completed (resolved or rejected)
const T & value() const FL_NOEXCEPT
Get the result value (only valid if is_resolved() returns true)
const Error & error() const FL_NOEXCEPT
Get the error (only valid if is_rejected() returns true)
bool valid() const FL_NOEXCEPT
Check if Promise is valid.
void update() FL_NOEXCEPT
Update Promise state in main loop - should be called periodically This processes pending callbacks wh...
bool is_resolved() const FL_NOEXCEPT
Check if Promise is resolved (completed successfully)
Promise class that provides fluent .then() and .catch_() semantics This is a lightweight wrapper arou...
Result type for promise operations.
virtual void update()=0
Update this runner (called during task pumping)
virtual size_t active_task_count() const =0
Get number of active tasks (for debugging/monitoring)
virtual ~Runner() FL_NOEXCEPT=default
virtual bool has_active_tasks() const =0
Check if this runner has active tasks.
Generic task runner interface.
Compile-time linker keep-alive hook for a single fl::Bus.
int & await_depth_tls()
Get reference to thread-local await recursion depth.
bool has_tasks()
Check if any systems have active tasks.
ExecFlags operator|(ExecFlags a, ExecFlags b)
void run(fl::u32 microseconds, ExecFlags flags)
Run selected task subsystems.
size_t active_tasks()
Get the number of active tasks across all systems.
PromiseResult< T > await_top_level(Promise< T > p)
Synchronously wait for a promise to complete (ONLY safe in top-level contexts)
PromiseResult< T > await(Promise< T > p)
Await promise completion in a coroutine (Trampoline to platform implementation)
ExecFlags
Flags controlling which subsystems run() pumps.
bool operator&(ExecFlags a, ExecFlags b)
Base definition for an LED controller.
Promise-based fluent API for FastLED - standalone async primitives.
Task scheduler — manages timer and frame-based tasks.