std::barrier::wait(3)
π 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
arrivalis associated with the phase synchronization point for the current phase of*this, then it blocks at the synchronization point associated witharrivaluntil 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
arrivalis 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
arrivalis 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β anarrival_tokenobtained by a previous call toarriveon 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 towait. 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
- 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