thread group c++ code example
Example: thread group c++
std::vector grp;
// to create threads
grp.emplace_back(functor); // pass in the argument of std::thread()
void join_all() {
for (auto& thread : grp)
if (thread.joinable())
thread.join();
}