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 takes mutex_type &__m.
  • unique_lock (mutex_type &__m, adopt_lock_t) noexcept β€” constructor with mutex_type &__m and an adopt_lock_t tag, marked noexcept.
  • template<typename _Rep , typename _Period > unique_lock (mutex_type &__m, const chrono::duration< _Rep, _Period > &__rtime) β€” constructor taking mutex_type &__m plus a chrono::duration< _Rep, _Period > named __rtime, templated on _Rep and _Period.
  • template<typename _Clock , typename _Duration > unique_lock (mutex_type &__m, const chrono::time_point< _Clock, _Duration > &__atime) β€” constructor taking mutex_type &__m plus a chrono::time_point< _Clock, _Duration > named __atime, templated on _Clock and _Duration.
  • unique_lock (mutex_type &__m, defer_lock_t) noexcept β€” constructor with mutex_type &__m and a defer_lock_t tag, marked noexcept.
  • unique_lock (mutex_type &__m, try_to_lock_t) β€” constructor with mutex_type &__m and a try_to_lock_t tag.
  • unique_lock (unique_lock &&__u) noexcept β€” move constructor, marked noexcept.
  • void lock () β€” member lock() with the exact signature right there.
  • mutex_type * mutex () const noexcept β€” returns a mutex_type *, marked const noexcept.
  • operator bool () const noexcept β€” the bool conversion operator, marked const noexcept.
  • unique_lock & operator= (const unique_lock &)=delete β€” copy assignment is deleted.
  • unique_lock & operator= (unique_lock &&__u) noexcept β€” move assignment, marked noexcept.
  • bool owns_lock () const noexcept β€” returns bool, marked const noexcept.
  • mutex_type * release () noexcept β€” returns a mutex_type *, marked noexcept.
  • void swap (unique_lock &__u) noexcept β€” swaps with __u, marked noexcept.
  • bool try_lock () β€” member try_lock() returning bool.
  • template<typename _Rep , typename _Period > bool try_lock_for (const chrono::duration< _Rep, _Period > &__rtime) β€” templated try_lock_for taking a chrono::duration< _Rep, _Period > named __rtime.
  • template<typename _Clock , typename _Duration > bool try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime) β€” templated try_lock_until taking a chrono::time_point< _Clock, _Duration > named __atime.
  • void unlock () β€” member unlock().

Quick note, bestie: these are not member symbols.

  • template<typename _Mutex > void swap (unique_lock< _Mutex > &__x, unique_lock< _Mutex > &__y) noexcept β€” Swap overload for unique_lock objects.

🌈 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


  • template<typename _Mutex > void swap (unique_lock< _Mutex > & __x, unique_lock< _Mutex > & __y) noexcept [related] β€” Swap overload for unique_lock objects.

πŸ’œ 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