Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ThreadPool Class Reference

This represents pool of threads. More...

#include <ThreadPool.h>

Public Member Functions

 ThreadPool (unsigned int count)
 Creates a new ThreadPool object.
 
template<class T , class... Args>
std::future< typename std::result_of< T(Args...)>::type > enqueue (T &&t, Args &&... args)
 Enqueues a new task for the threads to realize.
 
unsigned int getNumOfThreads ()
 Retrieves the number of threads of the pool.
 

Detailed Description

This represents pool of threads.

Constructor & Destructor Documentation

◆ ThreadPool()

ThreadPool::ThreadPool ( unsigned int count)

Creates a new ThreadPool object.

Parameters
countThe number of threads of the pool. It must not be 0.

Member Function Documentation

◆ enqueue()

template<class T , class... Args>
std::future< typename std::result_of< T(Args...)>::type > ThreadPool::enqueue ( T && t,
Args &&... args )
inline

Enqueues a new task for the threads to realize.

Parameters
tA function that realices a task.
argsThe arguments of the task.
Returns
A future of the same type as the return type of the task.

◆ getNumOfThreads()

unsigned int ThreadPool::getNumOfThreads ( )

Retrieves the number of threads of the pool.

Returns
The number of threads.

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