I am looking for a thread pool implementation based on C++11 threading facilities. The library should be preferably headers only. License has to be BSD style or MIT style permissive kind of license, i.e., no GPL.
There seems to be a GitHub of someone who developed a small library for C++ 11.
It also is just a central header file (no cpp files to add), and fits into your License requirements (it actually uses a permissive free software license).
I noticed this question trying to ask the same thing basically, except that I've already noticed a few, and I would like to get a proper recommendation/review of strengths and weaknesses rather than just a list. But for now, here's my list:
- CTPL - A no-frills single-header-only library; has two variants: one only relying on the standard library, the other using a lock-free queue implementation from Boost. ~250 lines lines at this time.
- threadpool11 by Tolga Hoşgör - "A fast, lock-free, cross-platform, full CPU utilizing thread pool implementation using C++11 features." claims to beat OpenMP in some benchmark; at the very least it means the author is proud and confident about it rather than just putting it out there... ~590 lines but that's with a lot more boilerplate license etc. So probably something like 500 lines.
- thread_pool by Tyler Hardin - A single-class, 1 .hpp + 1 .cpp, library (the choice of code to put in the .cpp is very reasonable, so this is not a weakness compared to CTPL). ~290 lines
- A Boost.ASIO-based 30-line threadpool implementation...
Now, I have not used any of these and cannot describe the differences between them, but would very much like someone with experience using threadpools to do so (in a separate answer).
ThreadPool is an easy-to-use header-only thread pool library using C++11 threading API, and no GPL.