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

◆ cancel_task() [1/2]

bool MayaFlux::Vruta::TaskScheduler::cancel_task ( const std::shared_ptr< Routine > &  routine)

Cancels and removes a task from the scheduler.

Parameters
routineShared pointer to the task to cancel
Returns
True if the task was found and cancelled, false otherwise

This method removes a task from the scheduler, preventing it from executing further. It's used to stop tasks that are no longer needed or to clean up before shutting down the engine.

Definition at line 62 of file Scheduler.cpp.

63{
64 auto it = find_task_by_routine(routine);
65 if (it != m_tasks.end()) {
66 if (routine && routine->is_active()) {
67 routine->set_should_terminate(true);
68 }
69 m_tasks.erase(it);
70 return true;
71 }
72 return false;
73}
std::vector< TaskEntry > m_tasks
std::vector< TaskEntry >::iterator find_task_by_routine(const std::shared_ptr< Routine > &routine)
Find task entry by routine pointer.

References find_task_by_routine(), and m_tasks.

Referenced by MayaFlux::Kriya::EventChain::cancel(), and MayaFlux::Kriya::Timer::cancel().

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