Simple threadpool, largely inspired by github.com/progschj/ThreadPool.
More...
#include <threadpool.hpp>
Simple threadpool, largely inspired by github.com/progschj/ThreadPool.
Definition at line 24 of file threadpool.hpp.
◆ ThreadPool()
ThreadPool::ThreadPool |
( |
size_t |
nt | ) |
|
|
inline |
◆ ~ThreadPool()
ThreadPool::~ThreadPool |
( |
| ) |
|
|
inline |
◆ autoChunks()
template<typename Container , typename F >
void ThreadPool::autoChunks |
( |
Container & |
v, |
|
|
size_t |
minChunkSize, |
|
|
double |
avgTasksPerThread, |
|
|
F |
f |
|
) |
| |
|
inline |
◆ enqueue()
template<class F >
auto ThreadPool::enqueue |
( |
F && |
f | ) |
|
|
inline |
◆ enqueueWithFuture()
template<class F >
auto ThreadPool::enqueueWithFuture |
( |
F && |
f | ) |
|
|
inline |
◆ getNbThreads()
size_t ThreadPool::getNbThreads |
( |
| ) |
|
|
inline |
◆ setNbThreads()
void ThreadPool::setNbThreads |
( |
size_t |
n | ) |
|
|
inline |
◆ waitUntilLast()
void ThreadPool::waitUntilLast |
( |
| ) |
|
|
inline |
◆ condition
std::condition_variable ThreadPool::condition |
|
private |
◆ currentTasks
std::atomic<int> ThreadPool::currentTasks |
|
private |
◆ nthreads
size_t ThreadPool::nthreads = 0 |
|
private |
◆ queue_mutex
std::mutex ThreadPool::queue_mutex |
|
private |
◆ stop
bool ThreadPool::stop = false |
|
private |
◆ tasks
std::queue<std::function<void()> > ThreadPool::tasks |
|
private |
◆ waitingLast
std::condition_variable ThreadPool::waitingLast |
|
private |
◆ workers
The documentation for this class was generated from the following file: