Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
ThreadPool< T > Class Template Reference
Collaboration diagram for ThreadPool< T >:
[legend]

Public Member Functions

 ThreadPool (int threadcount=4, int chunksize=100)
 
void map (std::function< void(T &)> function, std::vector< T > &data)
 
void map (std::function< void(T &)> function, std::vector< T > &data, int start, int end)
 

Protected Member Functions

void startWorkers ()
 
void worker ()
 
int getTask ()
 

Protected Attributes

std::vector< T > * m_tasks
 
std::function< void(T &)> m_function
 
std::vector< std::thread > m_workers
 
std::condition_variable m_startSignal
 
std::condition_variable m_stopSignal
 
std::mutex m_mutex
 
std::atomic_int m_currentIndex
 
int m_endIndex
 
int m_chunksize
 
bool m_exit
 
std::atomic_int m_startWorkers
 
std::atomic_int m_stoppedWorkers
 

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