Simple task scheduler, taski has support for work-stealing and work-sharing. Taski requires C++17, for an older version which only requires C++14, please use ff7c808.
- GCC >= 7.2.0
- Clang with support for C++17
// test.cpp
#include <iostream>
#include "taski/all.hpp"
int main() {
// number of workers -------------+
// |
// scheduling policy ------+ |
// | |
taski::scheduler<taski::stealing, 4> scheduler;
auto future = scheduler.enqueue([](auto i) {
return i + 1;
}, 42);
std::cout << "future: " << future.get() << std::endl;
}
Compile with: g++ -std=c++17 -Iinclude test.cpp
Taski's enqueue
function returns a std::future
if the given function has a return type. Otherwise run
returns a std::future<void>
.