12 : fMaxThreads(maxThreads), fNumLiveThreads(0),
13 fTasksCompleted(0), fTotalTasks(0), fProgress(0)
47 for(pthread_t& th:
fThreads) pthread_join(th, &junk);
pthread_mutex_t fThreadsLock
std::vector< pthread_t > fThreads
All threads we ever created.
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 SetProgress(double frac)
Update the progress fraction between zero and one.
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
void Done()
Call this when action is completed.
unsigned int fNumLiveThreads
Number of threads that are running.