![]() |
Sunshine latest
Self-hosted game stream host for Moonlight.
|
#include <src/thread_pool.h>
Public Types | |
typedef TaskPool::__task | __task |
![]() | |
typedef std::unique_ptr< _ImplBase > | __task |
typedef std::chrono::steady_clock::time_point | __time_point |
typedef _ImplBase * | task_id_t |
Public Member Functions | |
void | _main () |
void | join () |
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) |
void | start (int threads) |
void | stop () |
ThreadPool (int threads) | |
![]() | |
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 () |
TaskPool & | operator= (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 | |
Additional Inherited Members | |
![]() | |
std::mutex | _task_mutex |
std::deque< __task > | _tasks |
std::vector< std::pair< __time_point, __task > > | _timer_tasks |
Allow threads to execute unhindered while keeping full control over the threads.