std::thread 与线程生命周期 | C++

本章覆盖:`std::thread`;thread entry;join;detach;joinable;RAII thread wrapper;`std::jthread` 的 C++20 定位;thread argument passing;reference wrapper 的边界;exception across thread entry;不随意 detach 制造不可控生命周期。

本章知识点

  • std::thread
  • thread entry
  • join
  • detach
  • joinable
  • RAII thread wrapper
  • std::jthread 的 C++20 定位
  • thread argument passing
  • reference wrapper 的边界
  • exception across thread entry
  • 不随意 detach 制造不可控生命周期