#include <thread_pool.hpp>
Simple thread pool class. The pool consists of a given number of threads and a queue of tasks to be executed.
◆ thread_pool()
matador::thread_pool::thread_pool |
( |
std::size_t |
size | ) |
|
|
explicit |
Creating a new thread pool with given numbers of threads.
- Parameters
-
size | Number of provided threads. |
◆ add_task()
void matador::thread_pool::add_task |
( |
| ) |
|
Adds a new task to the thread queue.
◆ pending()
std::size_t matador::thread_pool::pending |
( |
| ) |
|
Returns the number of pending tasks.
- Returns
- Number of pending tasks.
◆ schedule()
template<typename F >
void matador::thread_pool::schedule |
( |
F |
func | ) |
|
|
inline |
Push a task into the thread pool to be executed once a thread is available
- Template Parameters
-
F | Type of threaded function |
- Parameters
-
func | Function to be executed in next available thread. |
◆ shutdown()
void matador::thread_pool::shutdown |
( |
| ) |
|
Shuts the thread pool down.
◆ size()
std::size_t matador::thread_pool::size |
( |
| ) |
const |
Returns the number of available threads.
- Returns
- Number of threads.
◆ wait()
void matador::thread_pool::wait |
( |
| ) |
|
Waits until all threads are finished.
The documentation for this class was generated from the following file:
- matador/utils/thread_pool.hpp