libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::ppd::no_signalling< Lk > Class Template Reference

Atomically count the amount of work that there is to do, and provide access to the lock on the containing collection. More...

#include <thread_safe_adaptors.hpp>

Public Types

typedef api_lock_traits< platform_api, sequential_mode >::anon_event_type atomic_t
 
typedef Lk locker_type
 
typedef locker_type::lock_traits lock_traits
 

Public Member Functions

constexpr no_signalling () noexcept(true) FORCE_INLINE
 
 no_signalling (atomic_t &ev) noexcept(true) FORCE_INLINE
 
constexpr no_signalling (no_signalling const &s) noexcept(true) FORCE_INLINE
 
atomic_t &__fastcall have_work () noexcept(true) FORCE_INLINE
 
locker_type &__fastcall locker () const noexcept(true) FORCE_INLINE
 
locker_type &__fastcall locker () noexcept(true)
 
void __fastcall add () noexcept(true) FORCE_INLINE
 
void __fastcall add (typename atomic_t::count_type const c) noexcept(true) FORCE_INLINE
 
atomic_t::atomic_state_type __fastcall remove () noexcept(true) FORCE_INLINE
 
void __fastcall remove (typename atomic_t::count_type const c) noexcept(true) FORCE_INLINE
 
atomic_t::atomic_state_type __fastcall try_remove () noexcept(true) FORCE_INLINE
 

Static Public Member Functions

static constexpr void clear () noexcept(true) FORCE_INLINE
 
static constexpr atomic_t::count_type __fastcall count () noexcept(true) FORCE_INLINE
 

Static Public Attributes

static constexpr generic_traits::memory_access_modes memory_access_mode
 

Detailed Description

template<class Lk>
class jmmcg::ppd::no_signalling< Lk >

Atomically count the amount of work that there is to do, and provide access to the lock on the containing collection.

This class adds a constant-time counter to the safe_colln or queue or funky_queue. This uses standard locks.

Todo:
I suppose I could use some kind of enable_if to detect if the container has a size() member-method, and only use this if it doesn't. That's a micro-optimisation to do.

Definition at line 70 of file thread_safe_adaptors.hpp.

Member Typedef Documentation

◆ atomic_t

template<class Lk >
typedef api_lock_traits<platform_api, sequential_mode>::anon_event_type jmmcg::ppd::no_signalling< Lk >::atomic_t

Definition at line 89 of file thread_safe_adaptors.hpp.

◆ lock_traits

template<class Lk >
typedef locker_type::lock_traits jmmcg::ppd::no_signalling< Lk >::lock_traits

Definition at line 91 of file thread_safe_adaptors.hpp.

◆ locker_type

template<class Lk >
typedef Lk jmmcg::ppd::no_signalling< Lk >::locker_type

Definition at line 90 of file thread_safe_adaptors.hpp.

Constructor & Destructor Documentation

◆ no_signalling() [1/3]

template<class Lk >
constexpr jmmcg::ppd::no_signalling< Lk >::no_signalling ( )
inlineconstexprnoexcept

Definition at line 103 of file thread_safe_adaptors.hpp.

◆ no_signalling() [2/3]

template<class Lk >
jmmcg::ppd::no_signalling< Lk >::no_signalling ( atomic_t ev)
inlineexplicitnoexcept

Definition at line 106 of file thread_safe_adaptors.hpp.

◆ no_signalling() [3/3]

template<class Lk >
constexpr jmmcg::ppd::no_signalling< Lk >::no_signalling ( no_signalling< Lk > const &  s)
inlineconstexprnoexcept

Definition at line 110 of file thread_safe_adaptors.hpp.

Member Function Documentation

◆ add() [1/2]

template<class Lk >
void __fastcall jmmcg::ppd::no_signalling< Lk >::add ( )
inlinenoexcept

Definition at line 127 of file thread_safe_adaptors.hpp.

◆ add() [2/2]

template<class Lk >
void __fastcall jmmcg::ppd::no_signalling< Lk >::add ( typename atomic_t::count_type const  c)
inlinenoexcept

Definition at line 132 of file thread_safe_adaptors.hpp.

◆ clear()

template<class Lk >
static constexpr void jmmcg::ppd::no_signalling< Lk >::clear ( void  )
inlinestaticconstexprnoexcept

Definition at line 157 of file thread_safe_adaptors.hpp.

◆ count()

template<class Lk >
static constexpr atomic_t::count_type __fastcall jmmcg::ppd::no_signalling< Lk >::count ( )
inlinestaticconstexprnoexcept

Definition at line 159 of file thread_safe_adaptors.hpp.

◆ have_work()

template<class Lk >
atomic_t& __fastcall jmmcg::ppd::no_signalling< Lk >::have_work ( )
inlinenoexcept

Definition at line 114 of file thread_safe_adaptors.hpp.

◆ locker() [1/2]

template<class Lk >
locker_type& __fastcall jmmcg::ppd::no_signalling< Lk >::locker ( ) const
inlinenoexcept

Definition at line 118 of file thread_safe_adaptors.hpp.

◆ locker() [2/2]

template<class Lk >
locker_type& __fastcall jmmcg::ppd::no_signalling< Lk >::locker ( )
inlinenoexcept

Definition at line 122 of file thread_safe_adaptors.hpp.

◆ remove() [1/2]

template<class Lk >
atomic_t::atomic_state_type __fastcall jmmcg::ppd::no_signalling< Lk >::remove ( )
inlinenoexcept

Definition at line 139 of file thread_safe_adaptors.hpp.

◆ remove() [2/2]

template<class Lk >
void __fastcall jmmcg::ppd::no_signalling< Lk >::remove ( typename atomic_t::count_type const  c)
inlinenoexcept

Definition at line 146 of file thread_safe_adaptors.hpp.

◆ try_remove()

template<class Lk >
atomic_t::atomic_state_type __fastcall jmmcg::ppd::no_signalling< Lk >::try_remove ( )
inlinenoexcept

Definition at line 153 of file thread_safe_adaptors.hpp.

Member Data Documentation

◆ memory_access_mode

template<class Lk >
constexpr generic_traits::memory_access_modes jmmcg::ppd::no_signalling< Lk >::memory_access_mode
staticconstexpr
Initial value:

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

Definition at line 96 of file thread_safe_adaptors.hpp.


The documentation for this class was generated from the following file:
jmmcg::ppd::generic_traits::memory_access_modes::erew_memory_access
Exclusive-Read, Exclusive-Write memory access.
jmmcg::ppd::generic_traits::memory_access_modes::crew_memory_access
Concurrent-Read, Exclusive-Write memory access.