MayaFlux 1.0.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 777 of file Scheduler.cpp.

778{
780 if (cross_tasks.empty()) {
781 return;
782 }
783
784 auto clock_it = m_token_clocks.find(clock_token);
785 if (clock_it == m_token_clocks.end()) {
786 return;
787 }
788
789 if (processing_units == 0) {
790 processing_units = 1;
791 }
792
793 uint64_t base = clock_it->second->current_position();
794
795 for (uint64_t i = 0; i < processing_units; ++i) {
796 uint64_t pos = base + i;
797 for (auto& routine : cross_tasks) {
798 if (routine && routine->is_active()) {
799 routine->try_resume_with_context(pos, context);
800 }
801 }
802 }
803}
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: