std::atomic...:notify_one(3)

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

✨ NAME ✨

Okay so bestie, we're in the C++ Standard Libary manual (yes, that's the manual name in the header β€” I don't make the rules 😭), and this page is all about:

std::atomic_flag::notify_one β€” std::atomic_flag::notify_one

Yes, the name is giving "said it twice to make it stick" πŸ’…. Iconic.


🌸 Synopsis 🌸

Here are the signatures, literally exact, no cap:

void notify_one() noexcept;          (1) (since C++20)
void notify_one() volatile noexcept; (2) (since C++20)

Both of these are since C++20 β€” vintage-ish but still fresh πŸ’–.

Performs atomic notifying operations.

If there is a thread blocked in atomic waiting operation (i.e. wait()) on *this, then unblocks at least one such thread; otherwise does nothing.


🫢 Return value 🫢

(none)

Literally none, bestie. No return value, no extra drama. πŸ’€


πŸ”₯ Notes πŸ”₯

This form of change-detection is often more efficient than simple polling or pure spinlocks.

Ngl, that's kind of a slay for performance. πŸ’…


😭 Example 😭

This section is incomplete.

Reason: no example

Not me opening the example section and finding out it's empty 🫠. It's giving "left on read."


πŸ‘‘ See also πŸ‘‘

  • wait β€” blocks the thread until notified and the atomic value changes. (C++20) (public member function)
  • atomic_flag_wait β€” blocks the thread until notified and the flag changes. (C++20) (function)
  • atomic_flag_wait_explicit β€” blocks the thread until notified and the flag changes. (C++20) (function)
  • atomic_flag_notify_one β€” notifies a thread blocked in atomic_flag_wait. (C++20) (function)

🏷️ Category 🏷️

  • * Todo no example

Source/version/date tea β˜•: http://cppreference.com Β· 2024.06.10 Β· page std::atomic...:notify_one(3)

Bye bestie β€” go unblock at least one thread and slay πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from