24 explicit ThreadPool(
unsigned int maxThreads = 0);
43 typedef std::function<void(void)>
func_t;
80 AddTaskHelper(std::bind(meth, obj,
args...));
pthread_mutex_t fThreadsLock
std::vector< pthread_t > fThreads
All threads we ever created.
void AddTask(F func, A...args)
Add task with arguments.
void Finish()
Wait for all threads to complete before returning.
std::function< void(void)> func_t
The type of the user's worker functions.
void AddTaskHelper(func_t func)
process_name opflashCryoW ana
ThreadPool(unsigned int maxThreads=0)
int fTotalTasks
How many tasks have we ever seen?
pthread_mutex_t fProgressLock
Protects fTasksCompleted and fTotalTasks too.
std::deque< func_t > fTasks
Actually, this is protecting fNumLiveThreads.
void AddMemberTask(T *obj, M meth, A...args)
Add member function task, with arguments.
static void * WorkerFunc(void *arg)
A very simple thread pool for use by Surface.
A simple ascii-art progress bar.
void ShowProgress(const std::string &title)
pthread_mutex_t fTasksLock
unsigned int fNumLiveThreads
Number of threads that are running.