FastLED 3.9.15
Loading...
Searching...
No Matches

◆ async_yield()

void fl::async_yield ( )

Platform-specific async yield function.

This function pumps all async tasks and yields control appropriately for the platform:

  • WASM: calls async_run() then emscripten_sleep(1) to yield to browser
  • Other platforms: calls async_run() multiple times with simple yielding

This centralizes platform-specific async behavior instead of having #ifdef in generic code.

Definition at line 68 of file async.cpp.

68 {
69 // Always pump all async tasks first
70 async_run();
71
72 // Platform-specific yielding behavior
73#ifdef __EMSCRIPTEN__
74 // WASM: Use emscripten_sleep to yield control to browser event loop
75 emscripten_sleep(1); // Sleep for 1ms to yield to browser
76#endif
77 for (int i = 0; i < 5; ++i) {
78 async_run(); // Give other async tasks a chance
79 }
80}
void async_run()
Run all registered async tasks once.
Definition async.cpp:63

References async_run().

Referenced by await_top_level().

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