CrossGuard
|
Timer class for asynchronous execution after a specified delay. More...
#include <Timer.h>
Public Member Functions | |
Timer () | |
Default constructor. Initializes the timer in a stopped state. | |
template<typename Function > | |
void | setTimeout (Function function, int delayMs) |
Starts a timer to execute a function after a specified delay. | |
void | stopTimer () |
Stops any ongoing timer and prevents the scheduled function from executing. | |
Timer class for asynchronous execution after a specified delay.
The Timer class allows scheduling a function to be executed after a specified delay. It provides functionality to stop the timer, preventing the execution of the function if needed.
|
inline |
Starts a timer to execute a function after a specified delay.
If there is an ongoing timer, it is stopped before starting the new one.
Function | Type of the function to be executed. |
function | Function to be executed after the delay. |
delayMs | Delay in milliseconds before the function is executed. |
|
inline |
Stops any ongoing timer and prevents the scheduled function from executing.
If the timer is already stopped or the function has already executed, this method does nothing.