std::lock_g...::lock_guard(3)
π std::lock_g...::lock_guard(3) π
okay so bestie, you're in the C++ Standard Libary manual, and this page is all about std::lock_guard::lock_guard. yes, the NAME is literally std::lock_guard::lock_guard β std::lock_guard::lock_guard. it's giving constructor main-character energy, fr fr. π
β¨ Synopsis β¨
three versions, all (since C++11), no cap:
explicit lock_guard( mutex_type& m ); (1) (since C++11)
lock_guard( mutex_type& m, std::adopt_lock_t t ); (2) (since C++11)
lock_guard( const lock_guard& ) = delete; (3) (since C++11)
this whole situation acquires ownership of the given mutex m. π«Ά
- Effectively calls
m.lock(). - Acquires ownership of the mutex
mwithout attempting to lock it. The behavior is undefined if the current thread does not hold a non-shared lock (i.e., a lock acquired bylock,try_lock,try_lock_for, ortry_lock_until) onm. π - Copy constructor is deleted.
The behavior is undefined ifmis destroyed before thelock_guardobject is. like, do not let that happen, bestie β undefined behavior is not the vibe. π
π Parameters π
mβ mutex to acquire ownership oftβ tag parameter used to select non-locking version of the constructor
π Exceptions π
- Throws any exceptions thrown by
m.lock(). - Throws nothing.
β¨ okay that's the whole page, bestie. source/version: cppreference.com Β· date: 2024.06.10 Β· manual: C++ Standard Libary Β· URL: http://cppreference.com Β· std::lock_g...::lock_guard(3) π¦
π¦ 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