nlib
nn::nlib::threading::SimpleCriticalSection Class Reference

Simplest critical section. Not reentrant. More...

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

Public Types

typedef nlib_mutexnative_handle_type
 typedef to a pointer type to a native mutex.
 

Public Member Functions

constexpr SimpleCriticalSection () noexcept
 Instantiates the object with default parameters (default constructor).
 
void lock () noexcept NLIB_LOCK_FUNC()
 Gets a lock, and enters the critical section. Blocks until it can get a lock.
 
void unlock () noexcept NLIB_UNLOCK_FUNC()
 Releases the lock, and exits the critical section.
 
bool try_lock () noexcept NLIB_TRYLOCK_FUNC(true)
 Gets a lock, and attempts to enter the critical section. More...
 
native_handle_type native_handle () noexcept
 Gets a pointer to a native type mutex. More...
 

Detailed Description

Simplest critical section. Not reentrant.

Description
Corresponds to std::mutex in C++11.

Definition at line 14 of file CriticalSection.h.

Member Function Documentation

nn::nlib::threading::SimpleCriticalSection::native_handle ( )
inlinenoexcept

Gets a pointer to a native type mutex.

Returns
The pointer to the mutex.

Definition at line 48 of file CriticalSection.h.

nn::nlib::threading::SimpleCriticalSection::try_lock ( )
inlinenoexcept

Gets a lock, and attempts to enter the critical section.

Returns
Returns true if a lock is acquired.

Definition at line 41 of file CriticalSection.h.


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