libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject > Class Template Reference

A class to control access to resource, possibly using the stack, using the RAII idiom. More...

#include <locking.hpp>

Inheritance diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >:
[legend]
Collaboration diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >:
[legend]

Public Types

typedef scope_lock< LockObject > base_t
 
typedef base_t::atomic_t atomic_t
 
typedef atomic_t::lock_traits lock_traits
 
typedef lock_traits::atomic_state_type atomic_state_type
 
typedef lock_traits::timeout_type timeout_type
 
typedef atomic_state_type lock_result_type
 
- Public Types inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::scope_lock< LockObject >
typedef lockable< typename LockObject::lock_traits > base_t
 
typedef LockObject atomic_t
 
typedef atomic_t::lock_traits lock_traits
 
typedef lock_traits::atomic_state_type atomic_state_type
 
typedef lock_traits::timeout_type timeout_type
 
typedef atomic_state_type lock_result_type
 
- Public Types inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::lockable< LockObject::lock_traits >
using lock_traits = LockObject::lock_traits
 
typedef lock_traits::atomic_state_type atomic_state_type
 
typedef lock_traits::timeout_type timeout_type
 

Public Member Functions

__stdcall in_process (atomic_t &lo, const timeout_type period=lock_traits::infinite_timeout()) noexcept(true) FORCE_INLINE
 Get control of the lock for the resource. More...
 
__stdcall ~in_process () noexcept(true) FORCE_INLINE
 Release the lock on the resource. More...
 
void decay () noexcept(true) FORCE_INLINE
 

Protected Member Functions

lock_result_type __fastcall try_lock () noexcept(true) override FORCE_INLINE
 
lock_result_type __fastcall lock () noexcept(false) override FORCE_INLINE
 
lock_result_type __fastcall lock (const timeout_type period) noexcept(false) override FORCE_INLINE
 
lock_result_type __fastcall unlock () noexcept(true) override FORCE_INLINE
 
- Protected Member Functions inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::scope_lock< LockObject >
__stdcall scope_lock (atomic_t &lo) noexcept(true) FORCE_INLINE
 
__stdcall scope_lock (atomic_t &lo, const timeout_type period) noexcept(true) FORCE_INLINE
 
 scope_lock (scope_lock const &)=delete
 
virtual __stdcall ~scope_lock () noexcept(true) FORCE_INLINE
 
void decay () noexcept(true) FORCE_INLINE
 

Additional Inherited Members

- Static Public Attributes inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::scope_lock< LockObject >
static constexpr generic_traits::memory_access_modes memory_access_mode =atomic_t::memory_access_mode
 
- Protected Attributes inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::scope_lock< LockObject >
atomic_tlocker
 

Detailed Description

template<class LockObject>
class jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >

A class to control access to resource, possibly using the stack, using the RAII idiom.

Use this lock for multiple threads in the same process space. Class to manipulate an in-process lock on the stack, with locking on construction, release on destruction. (The "LockObject &" will be valid.)

Definition at line 125 of file locking.hpp.

Member Typedef Documentation

◆ atomic_state_type

template<class LockObject >
typedef lock_traits::atomic_state_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::atomic_state_type

Definition at line 130 of file locking.hpp.

◆ atomic_t

template<class LockObject >
typedef base_t::atomic_t jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::atomic_t

Definition at line 128 of file locking.hpp.

◆ base_t

template<class LockObject >
typedef scope_lock<LockObject> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::base_t

Definition at line 127 of file locking.hpp.

◆ lock_result_type

Definition at line 132 of file locking.hpp.

◆ lock_traits

template<class LockObject >
typedef atomic_t::lock_traits jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::lock_traits

Definition at line 129 of file locking.hpp.

◆ timeout_type

template<class LockObject >
typedef lock_traits::timeout_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::timeout_type

Definition at line 131 of file locking.hpp.

Constructor & Destructor Documentation

◆ in_process()

template<class LockObject >
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::in_process ( atomic_t lo,
const timeout_type  period = lock_traits::infinite_timeout() 
)
inlineexplicitnoexcept

Get control of the lock for the resource.

Note that this may lock the resource.

Parameters
loThe lock for the resource.
periodThe period that should be waited for attempting to gain the lock on the resource.
See also
infinite_timeout()

Definition at line 97 of file locking_impl.hpp.

◆ ~in_process()

template<class LockObject >
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::~in_process
inlinenoexcept

Release the lock on the resource.

Definition at line 102 of file locking_impl.hpp.

Member Function Documentation

◆ decay()

template<class LockObject >
void jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::decay
inlinenoexcept

Definition at line 130 of file locking_impl.hpp.

◆ lock() [1/2]

template<class LockObject >
in_process< LockObject >::atomic_state_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::lock
inlineoverrideprotectedvirtualnoexcept

◆ lock() [2/2]

template<class LockObject >
in_process< LockObject >::atomic_state_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::lock ( const timeout_type  period)
inlineoverrideprotectedvirtualnoexcept
Parameters
periodThe period that should be waited for attempting to gain the lock on the resource.
See also
infinite_timeout()

Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::scope_lock< LockObject >.

Definition at line 118 of file locking_impl.hpp.

◆ try_lock()

template<class LockObject >
in_process< LockObject >::atomic_state_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::try_lock
inlineoverrideprotectedvirtualnoexcept

◆ unlock()

template<class LockObject >
in_process< LockObject >::atomic_state_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::lock::in_process< LockObject >::unlock
inlineoverrideprotectedvirtualnoexcept

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