MCPcopy Create free account
hub / github.com/FastLED/FastLED / suspend

Method suspend

src/platforms/shared/coroutine_context.cpp.hpp:144–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void CoroutineContext::suspend() FL_NOEXCEPT {
145 auto& platform = ICoroutinePlatform::instance();
146
147 // ISR guard
148 if (platform.inInterruptContext()) {
149 return;
150 }
151
152 CoroutineContext* self = globals().current;
153 if (!self) {
154 return; // Not inside a coroutine
155 }
156
157 void* runner = get_runner_ctx();
158 if (!runner) {
159 return;
160 }
161
162 // Check stack health before switching — catch overflow early
163 if (!platform.checkStackHealth(self->mPlatformCtx)) {
164 FL_WARN("FATAL: Stack overflow detected in coroutine");
165 while (true) {} // Halt — memory is already corrupted
166 }
167
168 // Switch back to runner
169 platform.contextSwitch(self->mPlatformCtx, runner);
170
171 // Resumed — we're back in the coroutine
172}
173
174//=============================================================================
175// CoroutineRunner Implementation

Callers

nothing calls this directly

Calls 4

get_runner_ctxFunction · 0.85
contextSwitchMethod · 0.80
inInterruptContextMethod · 0.45
checkStackHealthMethod · 0.45

Tested by

no test coverage detected