Skip to content

Schedule routines to run after a certain time or whenever the the timer expires.

License

Notifications You must be signed in to change notification settings

wniemiec-task-cpp/scheduler

Repository files navigation

Scheduler

Schedule routines to run after a certain time or whenever the the timer expires.

Coverage status Cpp compatibility Release License


❇ Introduction

Scheduler allows you to perform operations with routines so that they are executed according to a criterion.

❓ How to use

  1. Add the content of the src folder to the folder containing your project's source files

  2. Add the content of the include folder to the folder containing your project's header files

  3. Copy the Makefile to your project's root folder (if you already has one, merge the files)

  4. Run the following commands:

$ make clean
$ make
  1. 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.

📖 Documentation

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 -

🚩 Changelog

Details about each version are documented in the releases section.

🤝 Contribute!

See the documentation on how you can contribute to the project here.

📁 Files

/

Name Type Description
dist Directory Released versions
docs Directory Documentation files
src Directory Source files