Boost asio thread_pool join does not wait for tasks to be finished
The best practice is not to reuse the pool (what would be the use of pooling, if you keep creating new pools?). If you want to be sure you “time” the batches together, I’d suggest using when_all on futures: Live On Coliru #define BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY #include <iostream> #include <boost/bind.hpp> #include <boost/asio.hpp> #include <boost/thread.hpp> uint64_t foo(uint64_t begin) … Read more