jwpleow / ThreadPool

A simple C++17 Thread Pool implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThreadPool

A simple C++17 Thread Pool implementation.

Basic usage:

// create thread pool with 4 worker threads
ThreadPool pool(4);

// enqueue and store future (it's optional to store the future)
auto result = pool.enqueue([](int answer) { return answer; }, 42);

// get result from future
std::cout << result.get() << std::endl;

About

A simple C++17 Thread Pool implementation

License:zlib License


Languages

Language:C++ 86.9%Language:CMake 13.1%