https://github.com/dapper91/cpp_scheduler
C++ Scheduler
https://github.com/dapper91/cpp_scheduler
cpp cpp17 scheduler
Last synced: 4 months ago
JSON representation
C++ Scheduler
- Host: GitHub
- URL: https://github.com/dapper91/cpp_scheduler
- Owner: dapper91
- License: unlicense
- Created: 2018-03-28T17:25:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-01T18:25:37.000Z (almost 8 years ago)
- Last Synced: 2025-02-03T21:45:46.879Z (about 1 year ago)
- Topics: cpp, cpp17, scheduler
- Language: C++
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ scheduler
C++17 scheduler.
## Dependencies
* C++17
* Boost Range
* Boost Core
* Boost Uuid
* Boost Format
* Boost Fiber (for Fiber Engine only)
* Boost Process (for Process Engine only)
## Usage example
```c++
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std::literals::chrono_literals;
void print(const std::string& message)
{
std::stringstream message_stream;
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
std::time_t time = std::chrono::system_clock::to_time_t(now);
message_stream << "It's " << std::put_time(std::localtime(&time), "%T") << "\t" << message << std::endl;
std::cout << message_stream.str();
}
int main()
{
sched::Scheduler scheduler;
scheduler.add_job({
std::bind(print, "1 second has been passed"),
std::make_unique>(1s),
"1 sec interval task"
});
scheduler.add_job({
std::bind(print, "2 seconds have been passed"),
std::make_unique>(2s),
"2 sec interval task"
});
scheduler.add_job({
std::bind(print, "3 seconds have been passed"),
std::make_unique>(3s),
"3 sec interval task"
});
scheduler.start();
return 0;
}
```
## API
## License
Public Domain License