Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
task_pool_util::TaskPool Class Reference
Inheritance diagram for task_pool_util::TaskPool:
[legend]

Classes

class  timer_task_t

Public Types

typedef std::unique_ptr< _ImplBase > __task
typedef _ImplBase * task_id_t
typedef std::chrono::steady_clock::time_point __time_point

Public Member Functions

 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 ()

Protected Attributes

std::deque< __task > _tasks
std::vector< std::pair< __time_point, __task > > _timer_tasks
std::mutex _task_mutex

Detailed Description

Definition at line 47 of file task_pool.h.

Member Typedef Documentation

◆ __task

typedef std::unique_ptr<_ImplBase> task_pool_util::TaskPool::__task

Definition at line 49 of file task_pool.h.

◆ __time_point

typedef std::chrono::steady_clock::time_point task_pool_util::TaskPool::__time_point

Definition at line 52 of file task_pool.h.

◆ task_id_t

typedef _ImplBase* task_pool_util::TaskPool::task_id_t

Definition at line 50 of file task_pool.h.

Constructor & Destructor Documentation

◆ TaskPool()

task_pool_util::TaskPool::TaskPool ( TaskPool && other)
inlinenoexcept

Definition at line 74 of file task_pool.h.

Member Function Documentation

◆ cancel()

bool task_pool_util::TaskPool::cancel ( task_id_t task_id)
inline

Definition at line 188 of file task_pool.h.

◆ delay()

template<class X, class Y>
void task_pool_util::TaskPool::delay ( task_id_t task_id,
std::chrono::duration< X, Y > duration )
inline
Parameters
task_idThe id of the task to delay.
durationThe delay before executing the task.

Definition at line 158 of file task_pool.h.

◆ next()

std::optional< __time_point > task_pool_util::TaskPool::next ( )
inline

Definition at line 243 of file task_pool.h.

◆ operator=()

TaskPool & task_pool_util::TaskPool::operator= ( TaskPool && other)
inlinenoexcept

Definition at line 79 of file task_pool.h.

◆ pop() [1/2]

std::optional< __task > task_pool_util::TaskPool::pop ( )
inline

Definition at line 219 of file task_pool.h.

◆ pop() [2/2]

std::optional< std::pair< __time_point, __task > > task_pool_util::TaskPool::pop ( task_id_t task_id)
inline

Definition at line 205 of file task_pool.h.

◆ push()

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

Definition at line 87 of file task_pool.h.

◆ pushDelayed() [1/2]

template<class Function, class X, class Y, class... Args>
auto task_pool_util::TaskPool::pushDelayed ( Function && newTask,
std::chrono::duration< X, Y > duration,
Args &&... args )
inline
Returns
An id to potentially delay the task.

Definition at line 124 of file task_pool.h.

◆ pushDelayed() [2/2]

void task_pool_util::TaskPool::pushDelayed ( std::pair< __time_point, __task > && task)
inline

Definition at line 107 of file task_pool.h.

◆ ready()

bool task_pool_util::TaskPool::ready ( )
inline

Definition at line 237 of file task_pool.h.

Member Data Documentation

◆ _task_mutex

std::mutex task_pool_util::TaskPool::_task_mutex
protected

Definition at line 69 of file task_pool.h.

◆ _tasks

std::deque<__task> task_pool_util::TaskPool::_tasks
protected

Definition at line 67 of file task_pool.h.

◆ _timer_tasks

std::vector<std::pair<__time_point, __task> > task_pool_util::TaskPool::_timer_tasks
protected

Definition at line 68 of file task_pool.h.


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