MayaFlux 0.4.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 657 of file Scheduler.cpp.

658{
660 if (cross_tasks.empty()) {
661 return;
662 }
663
664 auto clock_it = m_token_clocks.find(clock_token);
665 if (clock_it == m_token_clocks.end()) {
666 return;
667 }
668
669 if (processing_units == 0) {
670 processing_units = 1;
671 }
672
673 uint64_t base = clock_it->second->current_position();
674
675 for (uint64_t i = 0; i < processing_units; ++i) {
676 uint64_t pos = base + i;
677 for (auto& routine : cross_tasks) {
678 if (routine && routine->is_active()) {
679 routine->try_resume_with_context(pos, context);
680 }
681 }
682 }
683}
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: