std::unique_lock::unlock(3)
π std::unique_lock::unlock β the C++ Standard Library one, bestie
okay so this is std::unique_lock::unlock from the C++ Standard Library, and like β the name literally tells you the whole plot, but we're gonna do it properly anyway because that's the vibe around here. π
β¨ Synopsis β¨
void unlock(); (since C++11)
Unlocks (i.e., releases ownership of) the associated mutex and releases ownership. That's the whole thing. It's a two-for-one: the mutex gets unlocked and the unique_lock stops owning it. Slay. π
std::system_error is thrown if there is no associated mutex or if the mutex is not locked.
no cap, if you call this on a lock that isn't holding anything, it's gonna yell at you. that's not me being dramatic, that's the standard. π
π«Ά Parameters π«Ά
(none) β she takes nothing, she needs nothing, she's low maintenance.
πΈ Return value πΈ
(none) β she gives nothing back either. iconic of her honestly. void behavior fr fr.
π₯ Exceptions π₯
- Any exceptions thrown by
mutex()->unlock(). - If there is no associated mutex or the mutex is not locked,
std::system_errorwith an error code ofstd::errc::operation_not_permitted.
β οΈ bestie read that second bullet again. no mutex attached or mutex not locked =std::system_errorwithstd::errc::operation_not_permitted. main character energy does not exempt you from the precondition check. π
π¦ Example π¦
This section is incomplete.
Reason: no example.
not me showing up with an empty example section π the authors literally left it as a todo, so we're not gonna make one up β that would be lying and lying is not the vibe. π
π See also π
lockβ locks (i.e., takes ownership of) the associated mutex (public member function)- the other one β disassociates the associated mutex without unlocking (i.e., releasing ownership of) it (public member function)
iykyk: one of these takes the mutex, one of these lets the mutex go without unlocking it. very different energy. do not mix them up. π§
π Category π
- Todo no example
β¨π okay that's the whole page, you ate that πβ¨
cute little sign-off because we're polite: this one came from cppreference.com, dated 2024.06.10, and it's std::unique_lock::unlock(3). go forth and unlock responsibly, bestie π
π«Ά
π¦ 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