std::recurs...tex::unlock(3)

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

🌸 NAME 🌸

okay so bestie, this is the std::recursive_mutex::unlock page from the C++ Standard Libary manual. It's the unlock member function for std::recursive_mutex, and she's literally here to handle your ownership level πŸ’….

✨ Synopsis ✨

void unlock();  (since C++11)

so what does she do? She unlocks the mutex if its level of ownership is 1 β€” meaning there was exactly one more call to lock() than there were calls to unlock() made by this thread. Otherwise, she reduces the level of ownership by 1 ✨.

🚨 The mutex must be locked by the current thread of execution, otherwise the behavior is undefined. no cap, that part is serious πŸ’€

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

πŸŽ€ Parameters πŸŽ€

(none) β€” she takes nothing, not even a little snack πŸ“.

🫢 Return value 🫢

(none) β€” returns nothing, she's too iconic for that.

πŸ’œ Exceptions πŸ’œ

Throws nothing. literally nothing. zero. πŸ•³οΈ

🌈 Notes 🌈

unlock() is usually not called directly: std::unique_lock and std::lock_guard are used to manage exclusive locking. so like, let the guard girlies handle it πŸ’….

πŸ¦‹ Example πŸ¦‹

This section is incomplete Reason: no example

πŸ‘‘ See also πŸ‘‘

  • lock β€” locks the mutex, blocks if the mutex is not available (public member function).
  • try_lock β€” tries to lock the mutex, returns if the mutex is not available (public member function).
  • C documentation for mtx_unlock β€” the C side of the story, linked from here.

Category: * Todo no example


mwah πŸ’– source: http://cppreference.com Β· version/date: 2024.06.10 Β· footer page name: std::recurs...tex::unlock(3). bye bestie, go unlock responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from