libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::ppd::pthreads::anon_mutex Class Reference

#include <posix_locking.hpp>

Inheritance diagram for jmmcg::ppd::pthreads::anon_mutex:
[legend]
Collaboration diagram for jmmcg::ppd::pthreads::anon_mutex:
[legend]

Classes

class  attr
 

Public Types

typedef lock::lockable< api_lock_traits< ppd::generic_traits::api_type::posix_pthreads, heavyweight_threading > > base_t
 
typedef base_t::lock_traits lock_traits
 
typedef base_t::atomic_state_type atomic_state_type
 
typedef lock_traits::exception_type exception_type
 
typedef lock::in_process< anon_mutexlock_type
 
typedef lock_type read_lock_type
 
typedef lock_type write_lock_type
 
typedef lock::in_process_unlockable< anon_mutexunlockable_type
 
typedef unlockable_type read_unlockable_type
 
typedef unlockable_type write_unlockable_type
 
using api_mutex_type = lock_traits::api_mutex_type
 
- Public Types inherited from jmmcg::ppd::lock::lockable< api_lock_traits< ppd::generic_traits::api_type::posix_pthreads, heavyweight_threading > >
using lock_traits = api_lock_traits< ppd::generic_traits::api_type::posix_pthreads, heavyweight_threading >
 
typedef lock_traits::atomic_state_type atomic_state_type
 
typedef lock_traits::timeout_type timeout_type
 

Public Member Functions

__stdcall anon_mutex () noexcept(false) FORCE_INLINE
 
 anon_mutex (anon_mutex const &)=delete
 
virtual __stdcall ~anon_mutex () noexcept(true) FORCE_INLINE
 
 operator api_mutex_type * () noexcept(true) FORCE_INLINE
 
atomic_state_type __fastcall lock (const timeout_type timeout) noexcept(true) override FORCE_INLINE final
 
atomic_state_type __fastcall lock () noexcept(true) override FORCE_INLINE final
 
atomic_state_type __fastcall unlock () noexcept(true) override FORCE_INLINE final
 
void decay () noexcept(true) FORCE_INLINE
 
- Public Member Functions inherited from jmmcg::ppd::lock::lockable< api_lock_traits< ppd::generic_traits::api_type::posix_pthreads, heavyweight_threading > >
virtual atomic_state_type __fastcall lock (const timeout_type) noexcept(false)=0
 
virtual atomic_state_type __fastcall try_lock () noexcept(true) FORCE_INLINE
 

Static Public Attributes

static constexpr generic_traits::memory_access_modes memory_access_mode =generic_traits::memory_access_modes::erew_memory_access
 

Protected Member Functions

__stdcall anon_mutex (const int shared, const int err_chk=PTHREAD_MUTEX_ERRORCHECK) noexcept(false) FORCE_INLINE
 

Friends

class mutex
 

Detailed Description

Note that this is not the most efficient mutex, but it is safer than default-created mutexes, as it uses PTHREAD_MUTEX_ERRORCHECK semantics [1].

[1] https://www.securecoding.cert.org/confluence/display/seccode/POS04-C.+Avoid+using+PTHREAD_MUTEX_NORMAL+type+mutex+locks

See also
PTHREAD_PROCESS_PRIVATE
PTHREAD_MUTEX_ERRORCHECK

Definition at line 109 of file posix_locking.hpp.

Member Typedef Documentation

◆ api_mutex_type

using jmmcg::ppd::pthreads::anon_mutex::api_mutex_type = lock_traits::api_mutex_type

Definition at line 121 of file posix_locking.hpp.

◆ atomic_state_type

◆ base_t

◆ exception_type

typedef lock_traits::exception_type jmmcg::ppd::pthreads::anon_mutex::exception_type

Definition at line 114 of file posix_locking.hpp.

◆ lock_traits

◆ lock_type

◆ read_lock_type

◆ read_unlockable_type

◆ unlockable_type

◆ write_lock_type

◆ write_unlockable_type

Constructor & Destructor Documentation

◆ anon_mutex() [1/3]

jmmcg::ppd::pthreads::anon_mutex::anon_mutex ( )
inlinenoexcept

Definition at line 156 of file posix_locking_impl.hpp.

◆ anon_mutex() [2/3]

jmmcg::ppd::pthreads::anon_mutex::anon_mutex ( anon_mutex const &  )
delete

◆ ~anon_mutex()

jmmcg::ppd::pthreads::anon_mutex::~anon_mutex ( )
inlinevirtualnoexcept

◆ anon_mutex() [3/3]

jmmcg::ppd::pthreads::anon_mutex::anon_mutex ( const int  shared,
const int  err_chk = PTHREAD_MUTEX_ERRORCHECK 
)
inlineexplicitprotectednoexcept

Member Function Documentation

◆ decay()

void jmmcg::ppd::pthreads::anon_mutex::decay ( )
inlinenoexcept

◆ lock() [1/2]

anon_mutex::atomic_state_type jmmcg::ppd::pthreads::anon_mutex::lock ( )
inlinefinaloverridevirtualnoexcept

◆ lock() [2/2]

anon_mutex::atomic_state_type jmmcg::ppd::pthreads::anon_mutex::lock ( const timeout_type  timeout)
inlinefinaloverridenoexcept

◆ operator api_mutex_type *()

jmmcg::ppd::pthreads::anon_mutex::operator api_mutex_type * ( )
inlinenoexcept

◆ unlock()

Friends And Related Function Documentation

◆ mutex

friend class mutex
friend

Definition at line 141 of file posix_locking.hpp.

Member Data Documentation

◆ memory_access_mode

constexpr generic_traits::memory_access_modes jmmcg::ppd::pthreads::anon_mutex::memory_access_mode =generic_traits::memory_access_modes::erew_memory_access
staticconstexpr

To assist in allowing compile-time computation of the algorithmic order of the threading model.

Definition at line 125 of file posix_locking.hpp.


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