std::cv_status(3)
β¨ std::cv_status β¨
okay so bestie, this is from the C++ Standard Library man pages, and honestly it's a little gem. Sit down, grab a strawberry π, let's go.
π NAME π
std::cv_status β bestie it is literally std::cv_status. That's the whole name. Iconic of it, honestly.
πΈ SYNOPSIS πΈ
Defined in header <condition_variable>:
enum class cv_status {
no_timeout, (since C++11)
timeout
};
that's it. that's the whole thing. two little values and a dream π
π¦ DESCRIPTION π¦
So std::cv_status is a scoped enumeration β enum class, she's fancy, she's namespaced, she's not letting you accidentally convert her to an int π
β and what she does is describe whether a timed wait came back because of a timeout, or not. That's the whole vibe check.
Who uses her? She's the return type bestie of the wait_for and wait_until member functions of std::condition_variable and std::condition_variable_any. So when you ask a condition variable to wait with a deadline, she tells you which of the two things actually happened. no cap. π
π MEMBER CONSTANTS π
no_timeoutβ the condition variable was awakened withnotify_all,notify_one, orβ¦ spuriously π yeah, spuriously, it happens, don't panic, it's normal.timeoutβ the condition variable was awakened by timeout expiration β° she ran out of time, periodt.
π SEE ALSO π
wait_forβ blocks the current thread until the condition variable is awakened or after the specified timeout duration π€ (public member function ofstd::condition_variable)wait_forβ blocks the current thread until the condition variable is awakened or after the specified timeout duration π€ (public member function ofstd::condition_variable_any)wait_untilβ blocks the current thread until the condition variable is awakened or until specified time point has been reached β³ (public member function ofstd::condition_variable)wait_untilβ blocks the current thread until the condition variable is awakened or until specified time point has been reached β³ (public member function ofstd::condition_variable_any)
yes bestie,wait_forshows up twice andwait_untilshows up twice β once for each condition variable class. that's not a typo, that's just how it is π«Ά
and that's the page!! sourced from http://cppreference.com, dated 2024.06.10, filed under std::cv_status(3) β go forth and timeout correctly, i believe in you ππ§ββοΈ
π¦ 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