std::condit...on_variable(3)
okay so bestie, welcome to the std::condit...on_variable(3) page from the C++ Standard Libary β yes, that's the manual name, typo and all, we keep the facts exact around here π
π NAME π
std::condition_variable::~condition_variableβstd::condition_variable::~condition_variable. that's the whole name, no cap π«Ά
β¨ Synopsis β¨
~condition_variable(); (since C++11)
wait, since C++11? iconic. this destructor has been doing its thing since then, periodt β¨
okay so this destructor destroys the object of type std::condition_variable. that's the whole job, and it ate π
π¨ it is only safe to invoke the destructor if all threads have been notified. that's the vibe check. but ngl, it is not required that they have exited their respective wait functions: some threads may still be waiting to reacquire the associated lock, or may be waiting to be scheduled to run after reacquiring it. no extra requirement, fr fr.
the programmer must ensure that no threads attempt to wait on *this once the destructor has been started β especially when the waiting threads are calling the wait functions in a loop or are using the overloads of the wait functions that take a predicate. this is the main-character responsibility, bestie π don't skip it.
π¦ See also π¦
- C documentation for
cnd_destroyβ the C-side bestie, iykyk π«Ά
that's the whole page, bestie: source is http://cppreference.com, dated 2024.06.10, and it's giving std::condit...on_variable(3) energy. mwah π
π¦ 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