MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ pump_cross()

void MayaFlux::Vruta::TaskScheduler::pump_cross ( DelayContext  context,
ProcessingToken  clock_token,
uint64_t  processing_units 
)
private

Pump the MULTI_RATE list from one clock's context.

Called as a fall-through from process_token when the driving token is SAMPLE_ACCURATE or FRAME_ACCURATE. Reads the driving clock's position and offers each cross routine a resume under the given context. The CrossRoutine gate decides eligibility and claims the resume atomically, so both threads may call this concurrently on the same list.

Parameters
contextSAMPLE_BASED from the audio thread, FRAME_BASED from graphics.
clock_tokenThe token whose clock position drives this pump.
processing_unitsUnits to advance, matching the driving token's call.

Definition at line 649 of file Scheduler.cpp.

650{
652 if (cross_tasks.empty()) {
653 return;
654 }
655
656 auto clock_it = m_token_clocks.find(clock_token);
657 if (clock_it == m_token_clocks.end()) {
658 return;
659 }
660
661 if (processing_units == 0) {
662 processing_units = 1;
663 }
664
665 uint64_t base = clock_it->second->current_position();
666
667 for (uint64_t i = 0; i < processing_units; ++i) {
668 uint64_t pos = base + i;
669 for (auto& routine : cross_tasks) {
670 if (routine && routine->is_active()) {
671 routine->try_resume_with_context(pos, context);
672 }
673 }
674 }
675}
std::unordered_map< ProcessingToken, std::shared_ptr< IClock > > m_token_clocks
Clock instances for each processing domain.
std::vector< std::shared_ptr< Routine > > get_tasks_for_token(ProcessingToken token) const
Get all tasks for a specific processing domain.
@ MULTI_RATE
Coroutine can handle multiple sample rates. Picks the frame-accurate processing token by default.

References get_tasks_for_token(), m_token_clocks, and MayaFlux::Vruta::MULTI_RATE.

Referenced by process_token().

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