/ReusableThreads

A header only C++-11 indexable persistent threads library

Primary LanguageC++MIT LicenseMIT

ReusableThreads

A header only C++-11 indexable persistent threads library

This library is a mashup of threadpools and standard threads. Here we construct persistent threads that can each be sent specific jobs.

This library is adapted from and inspired by threadpool and llvm.

Usage and API:

// initialize
ReusableThreads<NUM_THREADS> threads;
// add a task where:
//    thread_id is an integer in range(0,NUM_THREADS)
//    varargs is a common seperated list of input arguments to the function specified by function_ptr
threads.addTask(thread_id, function_ptr, varargs);
// wait until all threads finish their tasks
threads->sync();