std::atomic...g_notify_one(3)

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

okay so bestie, welcome to the C++ Standard Libary manual β€” today's main character is std::atomic...g_notify_one(3), and her whole thing is waking up at least one thread, not the entire group chat. πŸ’…βœ¨

🌸 NAME 🌸

  • std::atomic_flag_notify_one β€” std::atomic_flag_notify_one. yes, the name section is lowkey just the name twice; she ate and left no crumbs. πŸ’–

πŸ“ Synopsis πŸ“

Defined in header <atomic>
void atomic_flag_notify_one( std::atomic_flag* object ) noexcept;
(1) (since C++20)
void atomic_flag_notify_one( volatile std::atomic_flag* object )
(2) (since C++20)
noexcept;

Performs atomic notifying operations. big notify energy. πŸ””

If there is a thread blocked in an atomic waiting operation (i.e. std::atomic_flag_wait(), std::atomic_flag_wait_explicit(), or std::atomic_flag::wait()) on *object, then unblocks at least one such thread; otherwise does nothing.

Equivalent to object->notify_one().

πŸŽ€ Parameters πŸŽ€

  • object β€” pointer to the atomic_flag object to notify. that's the bestie getting poked awake. πŸ‘‰

πŸ’– Return value πŸ’–

  • (none) β€” literally no return value. she gives nothing and serves everything. πŸ’…

🧠 Notes 🧠

This form of change-detection is often more efficient than simple polling or pure spinlocks. no cap, that's the note. ⚑

🌈 Example 🌈

This section is incomplete Reason: no example

😭 not the example section being empty. we still love her.

πŸ‘€ See also πŸ‘€

  • notify_one β€” notifies at least one thread waiting on the atomic object. (C++20) (public member function of std::atomic_flag)
  • notify_all β€” notifies all threads blocked waiting on the atomic object. (C++20) (public member function of std::atomic_flag)
  • atomic_flag_notify_all β€” notifies all threads blocked in atomic_flag_wait. (C++20) (function)

πŸ—‚οΈ Category: πŸ—‚οΈ

  • Todo no example

mwah πŸ’‹ β€” source/version: http://cppreference.com, date: 2024.06.10, page: std::atomic...g_notify_one(3). byeee 🫢✨

πŸ“¦ where this page comes from