Schedule routines to run after a certain time or whenever the the timer expires.
Scheduler allows you to perform operations with routines so that they are executed according to a criterion.
-
Add the content of the
src
folder to the folder containing your project's source files -
Add the content of the
include
folder to the folder containing your project's header files -
Copy the
Makefile
to your project's root folder (if you already has one, merge the files) -
Run the following commands:
$ make clean
$ make
- Use it
[...]
#include "wniemiec/task/scheduler/Scheduler.hpp";
[...]
std::cout << "Hello... " << std::endl;
Scheduler::set_timeout([]() {
std::cout << "World!" << std::endl;
}, 2000);
[...]
Note: You can use cmake if you wish. To do this, use the CMakestd::lists.txt
file.
Property | Parameter type | Return type | Description | Default parameter value |
---|---|---|---|---|
set_iimeout | routine: std::function<void(void)>&, delay: long |
unsigned long |
Sets a timer which executes a routine once the timer expires | - |
set_interval | routine: std::function<void(void)>&, delay: long |
unsigned long |
Repeatedly calls a routine with a fixed time delay between each call | - |
clear_interval | id: unsigned long |
void |
Cancels a timed, repeating action | - |
clear_timeout | id: unsigned long |
void |
Cancels a timed action | - |
clear_all_timeout | void |
void |
Clear all timeouts | - |
clear_all_intervals | void |
void |
Clear all intervals | - |
set_timeout_to_routine | routine: std::function<void(void)>&, delay: long |
bool |
Runs a routine within a timeout. If the routine does not end on time, an interrupt signal will be sent to it | - |
Details about each version are documented in the releases section.
See the documentation on how you can contribute to the project here.
Name | Type | Description |
---|---|---|
dist | Directory |
Released versions |
docs | Directory |
Documentation files |
src | Directory |
Source files |