std::barrier::wait(3)

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

πŸ’… std::barrier::wait β€” the manual page, but make it make sense

okay bestie, welcome to std::barrier::wait from the C++ Standard Library (yes the header literally says "Libary", we don't talk about it πŸ’€). This is the page for the function that just... sits there and waits. Iconic behaviour honestly.


✨ NAME ✨

std::barrier::wait β€” literally std::barrier::wait. That's the whole name. No notes. πŸŽ€


🌸 SYNOPSIS 🌸

void wait( arrival_token&& arrival ) const;  (since C++20)

So it's void, it takes an rvalue ref to an arrival_token, and it's const. She's giving "I don't change anything, I just wait" energy. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

Okay so here's the tea, and you need to follow along because there are three whole situations:

  • Situation one, the main character case: if arrival is associated with the phase synchronization point for the current phase of *this, then it blocks at the synchronization point associated with arrival until the phase completion step of the synchronization point's phase is run. So yeah β€” it waits. At the sync point. Until that phase's completion step runs. Slay. ⭐
  • Situation two, the "you're a little late but it's fine" case: if arrival is associated with the phase synchronization point for the immediately preceding phase of *this, it returns immediately. No waiting. In and out. 🫢
  • Situation three, the "bestie what are you doing" case: otherwise β€” meaning arrival is associated with the phase synchronization point for an earlier phase of *this, or with any phase of a barrier object other than *this β€” the behavior is undefined. πŸ’€
fr fr, undefined behaviour is not a vibe. Do not pass a token from some other barrier, and do not pass a stale token from a way-earlier phase. That's the whole warning. Respect it. 😭

πŸŽ€ PARAMETERS πŸŽ€

  • arrival β€” an arrival_token obtained by a previous call to arrive on the same barrier. Same barrier. SAME. BARRIER. πŸ”₯

🌈 RETURN VALUE 🌈

(none)

That's it. She returns nothing. She's not here to give, she's here to wait. periodt. πŸ’…


🧚 EXCEPTIONS 🧚

Throws std::system_error with an error code allowed for mutex types on error. So like, if something goes wrong, that's what you're catching. 🌸


πŸ“ EXAMPLE πŸ“

This section is incomplete Reason: no example

yeah... no example. Not me showing up to the group chat with nothing to contribute πŸ™ˆ. Anyway, the section exists, and now you know it exists, and that's the whole point. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘

  • arrive β€” arrives at barrier and decrements the expected count (public member function). She's the one who makes the token you feed to wait. Bestie duo, honestly. ✨

πŸ”₯ CATEGORY πŸ”₯

  • Todo no example

(mood. we're all a work in progress.) πŸ’…


okay that's the whole page, tysm for coming to my TED talk 🫢 This lil masterpiece came from http://cppreference.com and it's dated 2024.06.10 β€” go drink some water and go wait at a synchronization point, ily πŸ’–πŸŒΊ

πŸ“¦ where this page comes from