Attempts to resume the coroutine with explicit temporal context.
- Parameters
-
| current_value | Current position in the timeline (samples, frames, cycles, etc.) |
| context | The temporal context being processed |
- Returns
- True if the coroutine was resumed, false otherwise
This context-aware resume method allows different temporal mechanisms to coexist within the same processing token. For example, both sample-based and buffer-cycle-based delays can use SAMPLE_ACCURATE token without interfering with each other.
The default implementation delegates to try_resume(uint64_t) for backward compatibility. Derived classes can override to implement context-specific resumption logic.
Reimplemented from MayaFlux::Vruta::Routine.
Definition at line 267 of file Routine.cpp.
268{
270 return false;
271
272 auto& promise_ref =
m_handle.promise();
273
274 if (promise_ref.should_terminate || !promise_ref.auto_resume) {
275 return false;
276 }
277
280 }
281
282 if (promise_ref.active_delay_context !=
DelayContext::NONE && promise_ref.active_delay_context != context) {
283 return false;
284 }
285
286 bool should_resume = false;
287
288 switch (context) {
291 should_resume = (current_value >= promise_ref.next_frame);
292 if (should_resume) {
293 promise_ref.next_frame = current_value + promise_ref.delay_amount;
294 }
295 } else {
296 should_resume = false;
297 }
298 break;
299
301 should_resume = true;
302 break;
303
304 default:
305 return false;
306 }
307
308 if (should_resume) {
310 return true;
311 }
312
313 return false;
314}
bool initialize_state(uint64_t current_frame=0U) override
Initializes the coroutine's state for execution.
bool is_active() const override
Checks if the coroutine is still active.
std::coroutine_handle< promise_type > m_handle
Handle to the underlying coroutine.
@ FRAME_BASED
Frame-rate delay (Graphics domain)
@ NONE
No active delay, try resume immediately.
@ AWAIT
Awaiter-induced delay (temporary suspension)
References MayaFlux::Vruta::AWAIT, MayaFlux::Vruta::FRAME_BASED, initialize_state(), is_active(), m_handle, and MayaFlux::Vruta::NONE.
Referenced by try_resume().