STD::UNIQUE_LOCK(3cxx)
π NAME π
std::unique_lock< _Mutex > β a movable scoped lock type. This is the 3cxx manual page for it, bestie, and yes that is literally the whole NAME section. π
π¦ SYNOPSIS π¦
#include <mutex>
π Public Types π
typedef _Mutex mutex_typeβ the mutex type this icon is working with.
π Public Member Functions π
unique_lock (const unique_lock &)=deleteβ copy construction? not happening, itβs deleted. periodt.unique_lock (mutex_type &__m)β constructor that takesmutex_type &__m.unique_lock (mutex_type &__m, adopt_lock_t) noexceptβ constructor withmutex_type &__mand anadopt_lock_ttag, markednoexcept.template<typename _Rep , typename _Period > unique_lock (mutex_type &__m, const chrono::duration< _Rep, _Period > &__rtime)β constructor takingmutex_type &__mplus achrono::duration< _Rep, _Period >named__rtime, templated on_Repand_Period.template<typename _Clock , typename _Duration > unique_lock (mutex_type &__m, const chrono::time_point< _Clock, _Duration > &__atime)β constructor takingmutex_type &__mplus achrono::time_point< _Clock, _Duration >named__atime, templated on_Clockand_Duration.unique_lock (mutex_type &__m, defer_lock_t) noexceptβ constructor withmutex_type &__mand adefer_lock_ttag, markednoexcept.unique_lock (mutex_type &__m, try_to_lock_t)β constructor withmutex_type &__mand atry_to_lock_ttag.unique_lock (unique_lock &&__u) noexceptβ move constructor, markednoexcept.void lock ()β memberlock()with the exact signature right there.mutex_type * mutex () const noexceptβ returns amutex_type *, markedconst noexcept.operator bool () const noexceptβ the bool conversion operator, markedconst noexcept.unique_lock & operator= (const unique_lock &)=deleteβ copy assignment is deleted.unique_lock & operator= (unique_lock &&__u) noexceptβ move assignment, markednoexcept.bool owns_lock () const noexceptβ returnsbool, markedconst noexcept.mutex_type * release () noexceptβ returns amutex_type *, markednoexcept.void swap (unique_lock &__u) noexceptβ swaps with__u, markednoexcept.bool try_lock ()β membertry_lock()returningbool.template<typename _Rep , typename _Period > bool try_lock_for (const chrono::duration< _Rep, _Period > &__rtime)β templatedtry_lock_fortaking achrono::duration< _Rep, _Period >named__rtime.template<typename _Clock , typename _Duration > bool try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime)β templatedtry_lock_untiltaking achrono::time_point< _Clock, _Duration >named__atime.void unlock ()β memberunlock().
π§ Related Symbols π§
Quick note, bestie: these are not member symbols.
template<typename _Mutex > void swap (unique_lock< _Mutex > &__x, unique_lock< _Mutex > &__y) noexceptβ Swap overload forunique_lockobjects.
π Detailed Description π
template<typename _Mutex>
class std::unique_lock< _Mutex >
A unique_lock controls mutex ownership within a scope. Ownership of the mutex can be delayed until after construction and can be transferred to another unique_lock by move construction or move assignment. If a mutex lock is owned when the destructor runs, ownership will be released. π₯
π°οΈ Since π°οΈ
C++11
π«Ά Friends And Related Symbol Documentation π«Ά
template<typename _Mutex > void swap (unique_lock< _Mutex > & __x, unique_lock< _Mutex > & __y) noexcept[related]β Swap overload forunique_lockobjects.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
mwah π β source/version: libstdc++; page: std::unique_lock< _Mutex >(3cxx); date: the original footer doesnβt list one, so no invented date here, bestie. π«Ά
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms