#include <BoundedThreadPool.hpp>
Definition at line 25 of file BoundedThreadPool.hpp.
◆ BoundedThreadPool() [1/3]
BoundedThreadPool::BoundedThreadPool |
( |
int |
n_threads | ) |
|
|
inlineexplicit |
◆ BoundedThreadPool() [2/3]
BoundedThreadPool::BoundedThreadPool |
( |
int |
n_threads, |
|
|
int |
limit |
|
) |
| |
|
inlineexplicit |
◆ BoundedThreadPool() [3/3]
BoundedThreadPool::BoundedThreadPool |
( |
| ) |
|
|
inline |
◆ ~BoundedThreadPool()
BoundedThreadPool::~BoundedThreadPool |
( |
| ) |
|
|
inline |
◆ init()
void BoundedThreadPool::init |
( |
int |
n_threads, |
|
|
int |
limit |
|
) |
| |
|
inline |
◆ join_threads()
void BoundedThreadPool::join_threads |
( |
| ) |
|
|
inline |
◆ push_task() [1/2]
template<typename T >
void BoundedThreadPool::push_task |
( |
const T & |
task | ) |
|
|
inline |
Definition at line 84 of file BoundedThreadPool.hpp.
86 std::unique_lock<std::mutex> lock(mtx_queue_full);
87 cnd_buffer_full.wait(lock, [
this]
88 {
return ((
int)tasks.size() <
limit); });
89 tasks.push(std::function<
void()>(task));
90 cnd_buffer_empty.notify_one();
◆ push_task() [2/2]
template<typename T , typename... A>
void BoundedThreadPool::push_task |
( |
const T & |
task, |
|
|
const A &... |
args |
|
) |
| |
|
inline |
◆ wait_for_completion()
void BoundedThreadPool::wait_for_completion |
( |
| ) |
|
|
inline |
Definition at line 100 of file BoundedThreadPool.hpp.
102 std::unique_lock<std::mutex> lock(mtx_queue_full);
103 cnd_buffer_full.wait(lock, [
this]
104 {
return tasks.empty(); });
◆ limit
int BoundedThreadPool::limit |
◆ n_threads
int BoundedThreadPool::n_threads |
The documentation for this class was generated from the following file: