Answers for "thread group c++"

C++
0

thread group c++

std::vector<std::thread> 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();
  }
Posted by: Guest on October-19-2020

Browse Popular Code Answers by Language