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

◆ cancel_task() [2/2]

bool MayaFlux::Vruta::TaskScheduler::cancel_task ( std::shared_ptr< Routine task)

Cancels and removes a task from the scheduler.

Parameters
taskShared 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 60 of file Scheduler.cpp.

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

References find_task_by_routine(), and m_tasks.

Referenced by MayaFlux::Kriya::Timer::cancel().

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