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

◆ execute()

void MayaFlux::Kriya::TimedAction::execute ( std::function< void()>  start_func,
std::function< void()>  end_func,
double  duration_seconds 
)

Executes a pair of functions with a time interval between them.

Parameters
start_funcFunction to execute immediately
end_funcFunction to execute after the duration
duration_secondsTime between start_func and end_func (in seconds)

This method executes start_func immediately, then schedules end_func to execute after the specified duration. This creates a timed action that starts now and automatically ends after the duration.

If an action is already in progress, it is cancelled before starting the new one.

Definition at line 60 of file Timers.cpp.

61{
62 cancel();
63 start_func();
64 m_timer.schedule(duration_seconds, end_func);
65}
void cancel()
Cancels any active action.
Definition Timers.cpp:67
Timer m_timer
The timer used to schedule the end function.
Definition Timers.hpp:202
void schedule(double delay_seconds, std::function< void()> callback)
Schedules a callback to execute after a delay.
Definition Timers.cpp:18

References cancel(), m_timer, and MayaFlux::Kriya::Timer::schedule().

+ Here is the call graph for this function: