#include <ThreadPool.hpp>
|
| ThreadPool (int threads=std::thread::hardware_concurrency()) |
|
void | Start (int threads=std::thread::hardware_concurrency()) |
|
size_t | Size () |
|
void | DoJob (std::function< void(void) > func) |
|
void | DoJob (std::function< void(void) > func, WaitVariable &wait) |
|
template<class InputIt , typename Function > |
void | ForEach (InputIt first, const size_t &elements, const Function &function) |
|
template<class InputIt , typename Function > |
void | ForEach (InputIt first, const size_t &elements, const Function &function, WaitVariable &wait) |
|
void | Wait (WaitVariable &wait) |
|
| ThreadPool (int threads=std::thread::hardware_concurrency()) |
|
| ~ThreadPool () |
|
void | Start (int threads=std::thread::hardware_concurrency()) |
|
size_t | Size () |
|
void | DoJob (std::function< void(void) > func) |
|
void | DoJob (std::function< void(void) > func, WaitVariable &wait) |
|
template<class InputIt , typename Function > |
void | ForEach (InputIt first, const size_t &elements, const Function &function) |
|
template<class InputIt , typename Function > |
void | ForEach (InputIt first, const size_t &elements, const Function &function, WaitVariable &wait) |
|
void | Wait (WaitVariable &wait) |
|
|
void | threadEntry (int i) |
|
void | threadEntry (int i) |
|
|
std::mutex | lock_ |
|
std::condition_variable | condVar_ |
|
bool | shutdown_ |
|
bool | started_ |
|
size_t | thread_count |
|
std::queue< std::function
< void(void) > > | jobs_ |
|
std::vector< std::thread > | threads_ |
|
atl::ThreadPool::ThreadPool |
( |
int |
threads = std::thread::hardware_concurrency() | ) |
|
|
inline |
Constructor. Sets the number of threads in this thread pool.
- Parameters
-
atl::ThreadPool::~ThreadPool |
( |
| ) |
|
|
inline |
Destructor. Shuts down all threads.
void atl::ThreadPool::DoJob |
( |
std::function< void(void) > |
func | ) |
|
|
inline |
Do a job that doesn't require wait.
- Parameters
-
void atl::ThreadPool::DoJob |
( |
std::function< void(void) > |
func, |
|
|
WaitVariable & |
wait |
|
) |
| |
|
inline |
Do a job that requires wait. The wait variable is incremented.
- Parameters
-
template<class InputIt , typename Function >
void atl::ThreadPool::ForEach |
( |
InputIt |
first, |
|
|
const size_t & |
elements, |
|
|
const Function & |
function |
|
) |
| |
|
inline |
template<class InputIt , typename Function >
void atl::ThreadPool::ForEach |
( |
InputIt |
first, |
|
|
const size_t & |
elements, |
|
|
const Function & |
function, |
|
|
WaitVariable & |
wait |
|
) |
| |
|
inline |
For each job with wait.
- Parameters
-
first | |
elements | |
function | |
wait | |
size_t atl::ThreadPool::Size |
( |
| ) |
|
|
inline |
Returns the number of threads in this thread pool.
- Returns
Wait for this wait variable to signal completion.
- Parameters
-
The documentation for this class was generated from the following file: