Use boost::asio to implement a simple thread pool in C++

Working on a personal machine learning project, I would like to train a model which can recognize my son. 

The first step is to extract my son’s faces from about 20K pictures. OpenCV can help a lot. It’s very handy and there already has the face cascade. Now the point is how to make the image processing faster. As a Java programmer, processing it in multiple threads is the first solution to try. After some searching, a lot of comments led me to boost::asio.

I was a C++ developer before C++11. I have to say, in the last several years, C++ got greatly improved. With boost::asio in C++, it becomes much easier to implement a simple thread pool, similar to Java concurrency.

thread_pool.h

thread_pool.cpp

Image processing code to make pictures smaller.