std::cv_status(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ 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 with notify_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 of std::condition_variable)
  • wait_for β€” blocks the current thread until the condition variable is awakened or after the specified timeout duration πŸ’€ (public member function of std::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 of std::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 of std::condition_variable_any)
yes bestie, wait_for shows up twice and wait_until shows 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