std::atomic_flag::test(3)

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

πŸ’– std::atomic_flag::test(3) πŸ’–

okay so hii bestie, welcome to this page from the C++ Standard Libary manual β€” it's literally about std::atomic_flag::test, and we're gonna make it make sense. no cap. 🫢


🌸 NAME 🌸

std::atomic_flag::test β€” std::atomic_flag::test

✨ Synopsis ✨

Here's the exact signature glow-up, bestie β€” keep the (1), (2), (since C++20), const volatile, const, and noexcept exactly where they are:

          bool test( std::memory_order order =
                         std::memory_order_seq_cst ) const volatile
       (1) (since C++20)
          noexcept;
          bool test( std::memory_order order =
       (2) (since C++20)
                         std::memory_order_seq_cst ) const noexcept;

So yeah: it atomically reads the value of the *this and returns the value. That's the whole vibe. ⭐

⚠️ warning bestie: if order is one of std::memory_order_release and std::memory_order_acq_rel, the behavior is undefined. not a drill. πŸ’€

πŸ’… Parameters πŸ’…

  • order β€” the memory synchronization ordering

πŸŽ€ Return value πŸŽ€

The value atomically read. periodt. πŸ’–

πŸ¦‹ Example πŸ¦‹

This section is incomplete. Reason: no example.

(not me being sad about the missing example 😭)

πŸ‘‘ See also πŸ‘‘

  • atomic_flag_test β€” (C++20)
  • atomic_flag_test_explicit β€” atomically returns the value of the flag (C++20) (function)

the (C++20) tags and the (function) tag are all preserved above β€” iykyk πŸ’…

🏷️ Category 🏷️

  • Todo no example

signed off from http://cppreference.com, date/version 2024.06.10 β€” bye bestie, go read those atomics! πŸ’œβœ¨

πŸ“¦ where this page comes from