neoGFX
Cross-platform C++ app/game engine
|
#include <thread_pool.hpp>
Classes | |
struct | no_threads |
struct | task_not_found |
Public Types | |
typedef std::shared_ptr< i_task > | task_pointer |
Public Member Functions | |
thread_pool () | |
~thread_pool () | |
void | reserve (std::size_t aMaxThreads) |
std::size_t | active_threads () const |
std::size_t | available_threads () const |
std::size_t | total_threads () const |
std::size_t | max_threads () const |
void | start (i_task &aTask, int32_t aPriority=0) |
void | start (task_pointer aTask, int32_t aPriority=0) |
bool | try_start (i_task &aTask, int32_t aPriority=0) |
bool | try_start (task_pointer aTask, int32_t aPriority=0) |
std::pair< std::future< void >, task_pointer > | run (std::function< void()> aFunction, int32_t aPriority=0) |
template<typename T > | |
std::pair< std::future< T >, task_pointer > | run (std::function< T()> aFunction, int32_t aPriority=0) |
bool | idle () const |
void | update_idle () |
bool | busy () const |
void | wait () const |
bool | stopped () const |
void | stop () |
std::recursive_mutex & | mutex () const |
Static Public Member Functions | |
static thread_pool & | default_thread_pool () |
Friends | |
class | thread_pool_thread |
Definition at line 52 of file thread_pool.hpp.
typedef std::shared_ptr<i_task> neolib::thread_pool::task_pointer |
Definition at line 56 of file thread_pool.hpp.
neolib::thread_pool::thread_pool | ( | ) |
neolib::thread_pool::~thread_pool | ( | ) |
std::size_t neolib::thread_pool::active_threads | ( | ) | const |
std::size_t neolib::thread_pool::available_threads | ( | ) | const |
bool neolib::thread_pool::busy | ( | ) | const |
|
static |
bool neolib::thread_pool::idle | ( | ) | const |
std::size_t neolib::thread_pool::max_threads | ( | ) | const |
std::recursive_mutex & neolib::thread_pool::mutex | ( | ) | const |
void neolib::thread_pool::reserve | ( | std::size_t | aMaxThreads | ) |
|
inline |
Definition at line 104 of file thread_pool.hpp.
std::pair< std::future< void >, task_pointer > neolib::thread_pool::run | ( | std::function< void()> | aFunction, |
int32_t | aPriority = 0 |
||
) |
void neolib::thread_pool::start | ( | task_pointer | aTask, |
int32_t | aPriority = 0 |
||
) |
void neolib::thread_pool::stop | ( | ) |
bool neolib::thread_pool::stopped | ( | ) | const |
std::size_t neolib::thread_pool::total_threads | ( | ) | const |
bool neolib::thread_pool::try_start | ( | task_pointer | aTask, |
int32_t | aPriority = 0 |
||
) |
void neolib::thread_pool::update_idle | ( | ) |
void neolib::thread_pool::wait | ( | ) | const |
Definition at line 54 of file thread_pool.hpp.