Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
thread_pool_util::ThreadPool Class Reference

#include <src/thread_pool.h>

Inheritance diagram for thread_pool_util::ThreadPool:
[legend]
Collaboration diagram for thread_pool_util::ThreadPool:
[legend]

Public Types

typedef TaskPool::__task __task
Public Types inherited from task_pool_util::TaskPool
typedef std::unique_ptr< _ImplBase > __task
typedef _ImplBase * task_id_t
typedef std::chrono::steady_clock::time_point __time_point

Public Member Functions

 ThreadPool (int threads)
template<class Function, class... Args>
auto push (Function &&newTask, Args &&...args)
void pushDelayed (std::pair< __time_point, __task > &&task)
template<class Function, class X, class Y, class... Args>
auto pushDelayed (Function &&newTask, std::chrono::duration< X, Y > duration, Args &&...args)
void start (int threads)
void stop ()
void join ()
void _main ()
Public Member Functions inherited from task_pool_util::TaskPool
 TaskPool (TaskPool &&other) noexcept
TaskPool & operator= (TaskPool &&other) noexcept
template<class Function, class... Args>
auto push (Function &&newTask, Args &&...args)
void pushDelayed (std::pair< __time_point, __task > &&task)
template<class Function, class X, class Y, class... Args>
auto pushDelayed (Function &&newTask, std::chrono::duration< X, Y > duration, Args &&...args)
template<class X, class Y>
void delay (task_id_t task_id, std::chrono::duration< X, Y > duration)
bool cancel (task_id_t task_id)
std::optional< std::pair< __time_point, __task > > pop (task_id_t task_id)
std::optional< __task > pop ()
bool ready ()
std::optional< __time_point > next ()

Additional Inherited Members

Protected Attributes inherited from task_pool_util::TaskPool
std::deque< __task > _tasks
std::vector< std::pair< __time_point, __task > > _timer_tasks
std::mutex _task_mutex

Detailed Description

Allow threads to execute unhindered while keeping full control over the threads.

Definition at line 17 of file thread_pool.h.

Member Typedef Documentation

◆ __task

typedef TaskPool::__task thread_pool_util::ThreadPool::__task

Definition at line 19 of file thread_pool.h.

Constructor & Destructor Documentation

◆ ThreadPool() [1/2]

thread_pool_util::ThreadPool::ThreadPool ( )
inline

Definition at line 30 of file thread_pool.h.

◆ ThreadPool() [2/2]

thread_pool_util::ThreadPool::ThreadPool ( int threads)
inlineexplicit

Definition at line 34 of file thread_pool.h.

◆ ~ThreadPool()

thread_pool_util::ThreadPool::~ThreadPool ( )
inlinenoexcept

Definition at line 42 of file thread_pool.h.

Member Function Documentation

◆ _main()

void thread_pool_util::ThreadPool::_main ( )
inline

Definition at line 100 of file thread_pool.h.

◆ join()

void thread_pool_util::ThreadPool::join ( )
inline

Definition at line 93 of file thread_pool.h.

◆ push()

template<class Function, class... Args>
auto thread_pool_util::ThreadPool::push ( Function && newTask,
Args &&... args )
inline

Definition at line 52 of file thread_pool.h.

◆ pushDelayed() [1/2]

template<class Function, class X, class Y, class... Args>
auto thread_pool_util::ThreadPool::pushDelayed ( Function && newTask,
std::chrono::duration< X, Y > duration,
Args &&... args )
inline

Definition at line 67 of file thread_pool.h.

◆ pushDelayed() [2/2]

void thread_pool_util::ThreadPool::pushDelayed ( std::pair< __time_point, __task > && task)
inline

Definition at line 60 of file thread_pool.h.

◆ start()

void thread_pool_util::ThreadPool::start ( int threads)
inline

Definition at line 76 of file thread_pool.h.

◆ stop()

void thread_pool_util::ThreadPool::stop ( )
inline

Definition at line 86 of file thread_pool.h.


The documentation for this class was generated from the following file: