Sunshine latest
Self-hosted game stream host for Moonlight.
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 std::chrono::steady_clock::time_point __time_point
 
typedef _ImplBasetask_id_t
 

Public Member Functions

bool cancel (task_id_t task_id)
 
template<class X , class Y >
void delay (task_id_t task_id, std::chrono::duration< X, Y > duration)
 
std::optional< __time_point > next ()
 
TaskPooloperator= (TaskPool &&other) noexcept
 
std::optional< __task > pop ()
 
std::optional< std::pair< __time_point, __task > > pop (task_id_t task_id)
 
template<class Function , class... Args>
auto push (Function &&newTask, Args &&...args)
 
template<class Function , class X , class Y , class... Args>
auto pushDelayed (Function &&newTask, std::chrono::duration< X, Y > duration, Args &&...args)
 
void pushDelayed (std::pair< __time_point, __task > &&task)
 
bool ready ()
 
 TaskPool (TaskPool &&other) noexcept
 

Protected Attributes

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

Member Function Documentation

◆ 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.

◆ pushDelayed()

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.

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