nlib
nn::nlib::threading::ScopedLock< T > Class Template Referencefinal

Wraps objects like CriticalSection. Locks with a constructor, and unlocks with a destructor. More...

#include "nn/nlib/threading/CriticalSection.h"

Public Types

typedef T mutex_type
 T.
 
typedef mutex_type::native_handle_type native_handle_type
 mutex_type::native_handle_type.
 

Public Member Functions

 ScopedLock (mutex_type &m) NLIB_ACQUIRE(lock_)
 Locks objects like CriticalSection (calls lock). More...
 
 ScopedLock (mutex_type &m, AdoptLockType) noexcept NLIB_ACQUIRE(lock_)
 Assumes an object like CriticalSection is already locked, and initializes the object without locking it. Unlocked in the destructor. More...
 
 ~ScopedLock () noexcept NLIB_RELEASE(lock_)
 Unlocks objects like CriticalSection (calls unlock).
 
native_handle_type native_handle () NLIB_RETURN_CAPABILITY(lock_)
 Returns an implementation-specific handle representing a lock.
 

Detailed Description

template<class T>
class nn::nlib::threading::ScopedLock< T >

Wraps objects like CriticalSection. Locks with a constructor, and unlocks with a destructor.

Template Parameters
TClasses such as CriticalSection.

Definition at line 245 of file CriticalSection.h.

Constructor & Destructor Documentation

◆ ScopedLock() [1/2]

template<class T>
nn::nlib::threading::ScopedLock< T >::ScopedLock ( mutex_type rhs)
inlineexplicit

Locks objects like CriticalSection (calls lock).

Parameters
[in]rhsObjects such as CriticalSection.

Definition at line 249 of file CriticalSection.h.

◆ ScopedLock() [2/2]

template<class T>
nn::nlib::threading::ScopedLock< T >::ScopedLock ( mutex_type rhs,
AdoptLockType   
)
inlinenoexcept

Assumes an object like CriticalSection is already locked, and initializes the object without locking it. Unlocked in the destructor.

Parameters
[in]rhsObjects such as CriticalSection.
Description
Use when objects like CriticalSection have been locked.

Definition at line 252 of file CriticalSection.h.


The documentation for this class was generated from the following files: