vsdk 12.0.0
 
Loading...
Searching...
No Matches
Vsdk::Utils::ThreadPool

#include <ThreadPool.hpp>

Public Member Functions

 ThreadPool ()
 
 ~ThreadPool ()
 
 ThreadPool (const ThreadPool &)=delete
 
ThreadPool & operator= (const ThreadPool &)=delete
 
void start (size_t threadCount=1)
 
void post (std::function< void()> task, bool discard=false)
 Enqueue a task.
 
void shutdown (bool waitPendingTasks=false)
 
bool isStarted () const
 

Constructor & Destructor Documentation

◆ ThreadPool() [1/2]

ThreadPool::ThreadPool ( )
explicit

◆ ~ThreadPool()

ThreadPool::~ThreadPool ( )

◆ ThreadPool() [2/2]

Vsdk::Utils::ThreadPool::ThreadPool ( const ThreadPool &  )
delete

Member Function Documentation

◆ operator=()

ThreadPool & Vsdk::Utils::ThreadPool::operator= ( const ThreadPool &  )
delete

◆ start()

void ThreadPool::start ( size_t  threadCount = 1)

◆ post()

void ThreadPool::post ( std::function< void()>  task,
bool  discard = false 
)

Enqueue a task.

Parameters
taskThe task to enqueue
discardIf true, if not started, the task will be discarded

◆ shutdown()

void ThreadPool::shutdown ( bool  waitPendingTasks = false)

◆ isStarted()

bool ThreadPool::isStarted ( ) const