std::recurs...tex::unlock(3)
π NAME π
std::recursive_timed_mutex::unlock β literally the unlock function of std::recursive_timed_mutex, no cap
okay bestie, so this one is short but she's important, so pay attention π
β¨ Synopsis β¨
void unlock(); (since C++11)
So here's the vibe πΈ: this bad girl unlocks the mutex if its level of ownership is 1. And what does that mean? It means there was exactly one more call to lock() than there were calls to unlock() made by this thread. Otherwise, she just reduces the level of ownership by 1. Cute, right? Recursive icon behavior π
π¨ Vibe check, and this one is serious: the mutex must be locked by the current thread of execution. If it's not? The behavior is undefined. Like, undefined undefined. Not a little undefined. Do not test her π
And the slay part: this operation synchronizes-with (as defined in std::memory_order) any subsequent lock operation that obtains ownership of the same mutex. Periodt. β
π«Ά Parameters π«Ά
(none)
Nothing! Zero. Empty. She takes no arguments, she's low maintenance like that π
π Return value π
(none)
She returns nothing because she's already given you everything (the unlocked mutex) π
π¦ Exceptions π¦
Throws nothing. Not a single thing. Not one exception. She's not dramatic like that π
π Notes π
Real talk π₯: unlock() is usually not called directly. Instead, std::unique_lock and std::lock_guard are used to manage exclusive locking. Those two are the main characters here, and unlock() is just out here doing supporting role energy. iykyk π
π Example π
This section is incomplete
Reason: no example
Yeah bestie, there's literally no example. The docs said "not today" π
πΈ 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)try_lock_forβ tries to lock the mutex, returns if the mutex has been unavailable for the specified timeout duration (public member function)try_lock_untilβ tries to lock the mutex, returns if the mutex has been unavailable until specified time point has been reached (public member function)- C documentation for
mtx_unlock
Category: Todo no example π (the to-do list remains untouched, iconic honestly)
and that's the whole page, bestie π§β¨ she's from cppreference.com, dated 2024.06.10 β the std::recurs...tex::unlock(3) era. go forth and unlock responsibly, mwah π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms