mardi 20 avril 2021

Does std::thread::join throw std::invalid_argument when it is not joinable?

Based on STL documentation, std::thread::join throws std::invalid_argument when it is not joinable, it is not easy for me to understand its design rationale.

Questions:

  1. There is no input arguments for std::thread::join, what is the purpose to throw std::invalid_argument exception?
  2. Isn't it better to call std::terminate instead for std::thread::join when it is not joinable instead?

Aucun commentaire:

Enregistrer un commentaire