std::shared...lock_shared(3)

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

okay so bestie, welcome to the C++ Standard Libary manual corner ✨ (yes, β€œLibary” is literally how the header spells it, we’re keeping the lore πŸ’€). today’s main character is std::shared_timed_mutex::unlock_shared, and she’s here to release a shared lock. let’s get into it. 🫢

πŸŽ€ NAME πŸŽ€

std::shared_timed_mutex::unlock_shared β€” std::shared_timed_mutex::unlock_shared

like yes, the manpage lists it twice, and honestly? duplicate queen behavior. πŸ’…

✨ Synopsis ✨

void unlock_shared();  (since C++14)

Releases the mutex from shared ownership by the calling thread. πŸ¦‹

The mutex must be locked by the current thread of execution in shared mode, otherwise, the behavior is undefined. 😭 no cap, undefined behavior is the scary one β€” do not play with that.

This operation synchronizes-with (as defined in std::memory_order) any subsequent lock() operation that obtains ownership of the same mutex. πŸ”₯

🌸 Parameters 🌸

(none) β€” literally no parameters, she takes nothing, we love a low-maintenance icon. πŸ’–

πŸ’œ Return value πŸ’œ

(none) β€” returns nothing, and that’s iconic. periodt.

πŸ™ˆ Exceptions πŸ™ˆ

Throws nothing. not a single exception, she’s chill like that. πŸ’…

πŸ¦‹ Notes πŸ¦‹

unlock_shared() is usually not called directly: std::shared_lock is used to manage shared locking. so like, let the std::shared_lock bestie handle it, iykyk. πŸŽ€

πŸ“ Example πŸ“

This section is incomplete Reason: no example

😭 it’s giving unfinished homework, but that’s exactly what the manpage says, so we’re not gonna invent one.

🧚 See also 🧚

  • lock_shared β€” locks the mutex for shared ownership, blocks if the mutex is not available (public member function)
  • unlock β€” unlocks the mutex (public member function)

⭐ Category ⭐

  • * Todo no example

from http://cppreference.com, dated 2024.06.10, page std::shared...lock_shared(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from