mvThreadPool icon indicating copy to clipboard operation
mvThreadPool copied to clipboard

An easy to use C++ Thread Pool

mvThreadPool

(This library is available under a free and permissive license)

mvThreadPool is a simple to use header only C++ threadpool based on work by Anthony Williams

Usage

To use this library, just include mvThreadPool.h in your project. The basic usage can be seen below:


int main()
{

  // create threadpool
  auto threadpool = Marvel::mvThreadPool();
  
  // submit function
  threadpool->submit(&SomeFunction);
  
  // submit function with arguments
  threadpool->submit(std::bind(&SomeVarFunction, arg1, arg2, ...));
  
  // submit a method
  threadpool->submit(std::bind(&SomeClass::SomeMethod, classInstance, arg1, arg2, ...));
  
}

Features

  • Work Stealing
  • Task Waiting

Notes

  • If the submitted function/method returns a value, the submit method will return a future.