Kleo::UniqueLock

Search for usage in LXR

Kleo::UniqueLock Class Reference

#include <uniquelock.h>

Public Member Functions

 UniqueLock (const UniqueLock &)=delete
 
 UniqueLock (QMutex &mutex)
 
 UniqueLock (QMutex &mutex, AdoptLockType) noexcept
 
template<typename Rep , typename Period >
 UniqueLock (QMutex &mutex, const std::chrono::duration< Rep, Period > &duration)
 
template<typename Clock , typename Duration >
 UniqueLock (QMutex &mutex, const std::chrono::time_point< Clock, Duration > &timePoint)
 
 UniqueLock (QMutex &mutex, DeferLockType) noexcept
 
 UniqueLock (QMutex &mutex, TryToLockType)
 
 UniqueLock (UniqueLock &&u) noexcept
 
void lock ()
 
QMutexmutex () const noexcept
 
 operator bool () const noexcept
 
UniqueLockoperator= (const UniqueLock &)=delete
 
UniqueLockoperator= (UniqueLock &&u) noexcept
 
bool owns_lock () const noexcept
 
QMutexrelease () noexcept
 
void swap (UniqueLock &u) noexcept
 
bool try_lock ()
 
template<typename Rep , typename Period >
bool try_lock_for (const std::chrono::duration< Rep, Period > &duration)
 
template<typename Clock , typename Duration >
bool try_lock_until (const std::chrono::time_point< Clock, Duration > &timePoint)
 
void unlock ()
 

Detailed Description

A movable scoped lock type for QMutex.

A UniqueLock controls mutex ownership within a scope. Ownership of the mutex can be delayed until after construction and can be transferred to another UniqueLock by move construction or move assignment. If a mutex lock is owned when the destructor runs ownership will be released.

Definition at line 57 of file uniquelock.h.

Constructor & Destructor Documentation

◆ UniqueLock() [1/8]

Kleo::UniqueLock::UniqueLock ( )
noexcept

Definition at line 22 of file uniquelock.cpp.

◆ UniqueLock() [2/8]

Kleo::UniqueLock::UniqueLock ( QMutex & mutex)
explicit

Definition at line 28 of file uniquelock.cpp.

◆ UniqueLock() [3/8]

Kleo::UniqueLock::UniqueLock ( QMutex & mutex,
DeferLockType  )
noexcept

Definition at line 36 of file uniquelock.cpp.

◆ UniqueLock() [4/8]

Kleo::UniqueLock::UniqueLock ( QMutex & mutex,
TryToLockType  )

Definition at line 42 of file uniquelock.cpp.

◆ UniqueLock() [5/8]

Kleo::UniqueLock::UniqueLock ( QMutex & mutex,
AdoptLockType  )
noexcept

Definition at line 48 of file uniquelock.cpp.

◆ UniqueLock() [6/8]

template<typename Clock , typename Duration >
Kleo::UniqueLock::UniqueLock ( QMutex & mutex,
const std::chrono::time_point< Clock, Duration > & timePoint )
inline

Definition at line 68 of file uniquelock.h.

◆ UniqueLock() [7/8]

template<typename Rep , typename Period >
Kleo::UniqueLock::UniqueLock ( QMutex & mutex,
const std::chrono::duration< Rep, Period > & duration )
inline

Definition at line 75 of file uniquelock.h.

◆ ~UniqueLock()

Kleo::UniqueLock::~UniqueLock ( )

Definition at line 55 of file uniquelock.cpp.

◆ UniqueLock() [8/8]

Kleo::UniqueLock::UniqueLock ( UniqueLock && u)
noexcept

Definition at line 62 of file uniquelock.cpp.

Member Function Documentation

◆ lock()

void Kleo::UniqueLock::lock ( )

Definition at line 84 of file uniquelock.cpp.

◆ mutex()

QMutex * Kleo::UniqueLock::mutex ( ) const
noexcept

Definition at line 148 of file uniquelock.cpp.

◆ operator bool()

Kleo::UniqueLock::operator bool ( ) const
explicitnoexcept

Definition at line 143 of file uniquelock.cpp.

◆ operator=()

UniqueLock & Kleo::UniqueLock::operator= ( UniqueLock && u)
noexcept

Definition at line 70 of file uniquelock.cpp.

◆ owns_lock()

bool Kleo::UniqueLock::owns_lock ( ) const
noexcept

Definition at line 138 of file uniquelock.cpp.

◆ release()

QMutex * Kleo::UniqueLock::release ( )
noexcept

Definition at line 130 of file uniquelock.cpp.

◆ swap()

void Kleo::UniqueLock::swap ( UniqueLock & u)
noexcept

Definition at line 124 of file uniquelock.cpp.

◆ try_lock()

bool Kleo::UniqueLock::try_lock ( )

Definition at line 98 of file uniquelock.cpp.

◆ try_lock_for()

template<typename Rep , typename Period >
bool Kleo::UniqueLock::try_lock_for ( const std::chrono::duration< Rep, Period > & duration)
inline

Definition at line 105 of file uniquelock.h.

◆ try_lock_until()

template<typename Clock , typename Duration >
bool Kleo::UniqueLock::try_lock_until ( const std::chrono::time_point< Clock, Duration > & timePoint)
inline

Definition at line 94 of file uniquelock.h.

◆ unlock()

void Kleo::UniqueLock::unlock ( )

Definition at line 114 of file uniquelock.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.