std::jthread::~jthread(3)
π std::jthread::~jthread(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::jthread::~jthread β yes, that spelling is in the header, we're keeping it π
. This is the destructor vibe check for jthread, and it's lowkey important.
β¨ NAME β¨
std::jthread::~jthread β std::jthread::~jthread
πΈ Synopsis πΈ
~jthread(); (since C++20)
This destructor destroys the jthread object.
If *this has an associated thread (joinable() == true), it calls request_stop() and then join(). no cap, that's the whole move.
π¦ Notes π¦
okay so request_stop() has no effect if the jthread was previously requested to stop. periodt.
A jthread object does not have an associated thread after any of these:
- it was default-constructed.
- it was moved from.
join()has been called.detach()has been called.
highkey danger: ifjoin()throws an exception (e.g. because deadlock is detected),std::terminate()may be called. π that's not a cute look, so pay attention.
π Example π
not the example section being incomplete π but fr fr:
This section is incomplete Reason: no example
π See also π
destructorβ destructs the thread object, underlying thread must be joined or detached (public member function ofstd::thread)
π Category π
- Todo no example
π okay that's the whole page, bestie β source/version: http://cppreference.com, date: 2024.06.10 π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms