FastLED 3.10.8
Loading...
Searching...
No Matches

◆ yield_system()

void fl::task::yield_system ( fl::u32 microseconds)

OS-level yield only: same behavior as run(us, ExecFlags::SYSTEM).

Prefer this in driver/DMA wait loops. run() dispatches on its flags at runtime, so even a SYSTEM-only call links the task Scheduler and Executor into every sketch; this entry point references neither (#4797). microseconds > 0 deep-yields (>= 1 FreeRTOS tick on ESP32) until the budget is spent; 0 is a single lightweight fl::yield().

Definition at line 172 of file executor.cpp.hpp.

172 {
173 // Mirrors the SYSTEM branch of run() without naming Scheduler/Executor.
174 const fl::u32 begin_time = fl::micros();
175 do {
176 if (microseconds > 0) {
177 const fl::u32 e = fl::micros() - begin_time;
178 if (e < microseconds) {
179 fl::platforms::ICoroutineRuntime::instance().pumpCoroutines(
180 fl::min(1000u, microseconds - e));
181 }
182 } else {
183 fl::yield();
184 }
185 } while (fl::micros() - begin_time < microseconds);
186}
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
Definition math.h:71
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
void yield() FL_NO_EXCEPT
Yield to the platform scheduler.
Definition yield.cpp.hpp:32

References fl::FL_NO_EXCEPT, fl::micros(), fl::min(), and fl::yield().

Referenced by throttleToMaxRefreshRate(), fl::ChannelManager::waitForCondition(), and fl::IChannelDriver::waitForCondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: