Distributed Cache
Public Member Functions | Private Attributes | List of all members
WorkerPool< T > Class Template Reference
Collaboration diagram for WorkerPool< T >:
Collaboration graph

Public Member Functions

 WorkerPool (std::function< void(T)> executor, int threadCount=0, bool exitWhenDone=true)
 
void insert (T obj)
 
void insert (std::vector< T > &objects)
 
void start (int c=0)
 
void threadRunner ()
 
void join ()
 

Private Attributes

std::function< void(T)> executor
 
std::queue< T > queue
 
std::mutex queueLock
 
std::vector< std::thread > threads
 
int threadCount
 

Constructor & Destructor Documentation

◆ WorkerPool()

template<typename T >
WorkerPool< T >::WorkerPool ( std::function< void(T)>  executor,
int  threadCount = 0,
bool  exitWhenDone = true 
)
inline

Member Function Documentation

◆ insert() [1/2]

template<typename T >
void WorkerPool< T >::insert ( std::vector< T > &  objects)
inline

◆ insert() [2/2]

template<typename T >
void WorkerPool< T >::insert ( T  obj)
inline
Here is the caller graph for this function:

◆ join()

template<typename T >
void WorkerPool< T >::join ( )
inline
Here is the caller graph for this function:

◆ start()

template<typename T >
void WorkerPool< T >::start ( int  c = 0)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ threadRunner()

template<typename T >
void WorkerPool< T >::threadRunner ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ executor

template<typename T >
std::function<void(T)> WorkerPool< T >::executor
private

◆ queue

template<typename T >
std::queue<T> WorkerPool< T >::queue
private

◆ queueLock

template<typename T >
std::mutex WorkerPool< T >::queueLock
private

◆ threadCount

template<typename T >
int WorkerPool< T >::threadCount
private

◆ threads

template<typename T >
std::vector<std::thread> WorkerPool< T >::threads
private

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