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

Method resume

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

Source from the content-addressed store, hash-verified

108}
109
110void CoroutineContext::resume() FL_NOEXCEPT {
111 if (mCompleted) {
112 return;
113 }
114
115 auto& platform = ICoroutinePlatform::instance();
116
117 // ISR guard — context switching from interrupt handler corrupts state
118 if (platform.inInterruptContext()) {
119 return;
120 }
121
122 // Re-entrancy guard: if another coroutine is already running (e.g. a
123 // coroutine called suspend() which re-entered run()), skip. There's
124 // only one runner context save slot — a nested contextSwitch would
125 // overwrite it.
126 if (globals().current != nullptr) {
127 return;
128 }
129
130 globals().current = this;
131 mStarted = true;
132
133 void* runner = get_runner_ctx();
134 platform.contextSwitch(runner, mPlatformCtx);
135
136 // We're back — coroutine suspended or completed
137 globals().current = nullptr;
138}
139
140CoroutineContext* CoroutineContext::runningCoroutine() FL_NOEXCEPT {
141 return globals().current;

Callers 1

runMethod · 0.45

Calls 3

get_runner_ctxFunction · 0.85
contextSwitchMethod · 0.80
inInterruptContextMethod · 0.45

Tested by

no test coverage detected