libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
An adaptor for a container that attempts to add some thread-safety to assist in making thread-safe programs. More...
#include <thread_safe_adaptors.hpp>
Inherits C.
Public Types | |
typedef C | container_type |
The container to be adapted. More... | |
typedef Sig | have_work_type |
Used to enable functionality to atomically signal if the container contains work or not. More... | |
typedef M | atomic_t |
The underlying lock object to use that will be locked in some (EREW or CREW or other) manner. More... | |
typedef WL | write_lock_type |
The type of write-lock to use. This allows the possibility of using a read-write lock. More... | |
typedef atomic_t::read_lock_type | read_lock_type |
The type of read lock to use, by default the write lock. This allows the possibility of using a read-write lock. More... | |
typedef MLk | lock_all_type |
The multi-lock type to use to ensured that operations on combined safe_collns are thread-safe. Note that locking them in any order reduces the likelihood of deadlock at the cost of performance. More... | |
typedef atomic_t::lock_traits | lock_traits |
typedef api_threading_traits< lock_traits::api_type, typename lock_traits::model_type > | thread_traits |
typedef container_type::reference | reference |
typedef container_type::const_reference | const_reference |
typedef container_type::size_type | size_type |
typedef container_type::value_type | value_type |
typedef lock_traits::exception_type | exception_type |
using | exit_requested_type = typename have_work_type::atomic_t |
Public Member Functions | |
BOOST_MPL_ASSERT ((std::is_same< typename write_lock_type::atomic_t, atomic_t >)) | |
atomic_t &__fastcall | pop_lock () noexcept(true) FORCE_INLINE |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code. More... | |
atomic_t &__fastcall | pop_lock () const noexcept(true) FORCE_INLINE |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code. More... | |
atomic_t &__fastcall | push_lock () noexcept(true) FORCE_INLINE |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code. More... | |
atomic_t &__fastcall | push_lock () const noexcept(true) FORCE_INLINE |
A flag to atomically signal if the container contains work or not, and how much work and the underlying lock, to assist in writing thread-safe code. More... | |
__stdcall | safe_colln () noexcept(noexcept(container_type()) &&noexcept(have_work_type())) FORCE_INLINE |
safe_colln (typename have_work_type::atomic_t &) FORCE_INLINE | |
safe_colln (std::initializer_list< value_type >) FORCE_INLINE | |
__stdcall | safe_colln (size_type const sz, value_type const &v=value_type()) FORCE_INLINE |
template<class T1 , class T2 > | |
__stdcall FORCE_INLINE | safe_colln (size_type const sz, T1 const &, T2 const &) |
__stdcall | safe_colln (const container_type &) FORCE_INLINE |
__stdcall | safe_colln (const safe_colln &) noexcept(false) FORCE_INLINE |
__stdcall | ~safe_colln () FORCE_INLINE |
safe_colln &__fastcall | operator= (const safe_colln &) noexcept(false) FORCE_INLINE |
bool __fastcall | empty () const noexcept(true) FORCE_INLINE |
size_type __fastcall | sync_size () const noexcept(false) FORCE_INLINE |
size_type __fastcall | size () const noexcept(true) FORCE_INLINE |
value_type __fastcall | operator[] (size_type s) const noexcept(false) FORCE_INLINE |
void __fastcall | push_back (value_type const &v) noexcept(false) FORCE_INLINE |
void __fastcall | push_back (value_type &&v) noexcept(false) FORCE_INLINE |
void __fastcall | push_front (const value_type &v) noexcept(false) FORCE_INLINE |
void __fastcall | push_front (value_type &&v) noexcept(false) FORCE_INLINE |
size_type __fastcall | erase (const value_type &v) noexcept(false) FORCE_INLINE |
void __fastcall | reserve (size_type sz) noexcept(false) FORCE_INLINE |
void __fastcall | clear () noexcept(false) FORCE_INLINE |
void __fastcall | swap (safe_colln &t) noexcept(false) FORCE_INLINE |
void __fastcall | resize_noinit_nolk (const size_type sz) noexcept(false) FORCE_INLINE |
Resize the container to the requested size, but try to minimise (re-)initialising or deleting any of the existing elements. More... | |
void __fastcall | resize (const size_type sz) noexcept(false) FORCE_INLINE |
Resize the container to the requested size. More... | |
bool __fastcall | operator== (safe_colln const &) const noexcept(true) FORCE_INLINE |
template<typename M1 , typename WL1 , class Sig1 , class MLk1 > | |
bool __fastcall FORCE_INLINE | operator== (safe_colln< C, M1, WL1, Sig1, MLk1 > const &) const noexcept(true) |
container_type const & | colln () const noexcept(true) FORCE_INLINE |
container_type & | colln () noexcept(true) FORCE_INLINE |
template<class T1 , class T2 > | |
safe_colln (size_type const sz, T1 const &, T2 const &) | |
template<typename M1 , typename WL1 , class Sig1 , class MLk1 > | |
bool | operator== (safe_colln< C, M1, WL1, Sig1, MLk1 > const &sc) const noexcept(true) |
Public Attributes | |
have_work_type | have_work |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code. More... | |
Static Public Attributes | |
static constexpr generic_traits::memory_access_modes | memory_access_mode |
An adaptor for a container that attempts to add some thread-safety to assist in making thread-safe programs.
By default the adapted container does not use a read-write lock. Note that if the read_lock_type and write_lock_types are the same, i.e. an exclusive lock were used, then the adaptor will exhibit EREW semantics. If a read-writer lock is used for them ,then it will exhibit CREW semantics.
Definition at line 203 of file thread_safe_adaptors.hpp.
typedef M jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::atomic_t |
The underlying lock object to use that will be locked in some (EREW or CREW or other) manner.
Definition at line 208 of file thread_safe_adaptors.hpp.
typedef container_type::const_reference jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::const_reference |
Definition at line 215 of file thread_safe_adaptors.hpp.
typedef C jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::container_type |
The container to be adapted.
Definition at line 206 of file thread_safe_adaptors.hpp.
typedef lock_traits::exception_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::exception_type |
Definition at line 218 of file thread_safe_adaptors.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::exit_requested_type = typename have_work_type::atomic_t |
Definition at line 219 of file thread_safe_adaptors.hpp.
typedef Sig jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work_type |
Used to enable functionality to atomically signal if the container contains work or not.
Definition at line 207 of file thread_safe_adaptors.hpp.
typedef MLk jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::lock_all_type |
The multi-lock type to use to ensured that operations on combined safe_collns are thread-safe. Note that locking them in any order reduces the likelihood of deadlock at the cost of performance.
Definition at line 211 of file thread_safe_adaptors.hpp.
typedef atomic_t::lock_traits jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::lock_traits |
Definition at line 212 of file thread_safe_adaptors.hpp.
typedef atomic_t::read_lock_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::read_lock_type |
The type of read lock to use, by default the write lock. This allows the possibility of using a read-write lock.
Definition at line 210 of file thread_safe_adaptors.hpp.
typedef container_type::reference jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::reference |
Definition at line 214 of file thread_safe_adaptors.hpp.
typedef container_type::size_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::size_type |
Definition at line 216 of file thread_safe_adaptors.hpp.
typedef api_threading_traits<lock_traits::api_type, typename lock_traits::model_type> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::thread_traits |
Definition at line 213 of file thread_safe_adaptors.hpp.
typedef container_type::value_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::value_type |
Definition at line 217 of file thread_safe_adaptors.hpp.
typedef WL jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::write_lock_type |
The type of write-lock to use. This allows the possibility of using a read-write lock.
Definition at line 209 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 83 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlineexplicit |
Definition at line 88 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlineexplicit |
Definition at line 93 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlineexplicit |
Definition at line 98 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
__stdcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::safe_colln | ( | size_type const | sz, |
T1 const & | , | ||
T2 const & | |||
) |
|
inlineexplicit |
Definition at line 110 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 116 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inline |
Definition at line 124 of file thread_safe_adaptors_impl.hpp.
|
inline |
Definition at line 104 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::BOOST_MPL_ASSERT | ( | (std::is_same< typename write_lock_type::atomic_t, atomic_t >) | ) |
|
inlinenoexcept |
Definition at line 217 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 310 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 313 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 139 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 198 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 128 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 226 of file thread_safe_adaptors_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 235 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 163 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code.
Definition at line 244 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code.
Definition at line 240 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 176 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 169 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 183 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 190 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
A flag to atomically signal if the container contains work or not, and how much work and the underlying lock, to assist in writing thread-safe code.
Definition at line 252 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code.
Definition at line 248 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 211 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Resize the container to the requested size.
Definition at line 256 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Resize the container to the requested size, but try to minimise (re-)initialising or deleting any of the existing elements.
Current C++03 & C++11 containers have an implicit sequential order of initialisation or re-initialisation of the elements they contain. This enforces a O(n) complexity on resize(). To minimise this (re-)initialisation of existing elements, only initialise new elements added to the container, or delete the excess.
Definition at line 242 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
inlinenoexcept |
Definition at line 156 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 268 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 146 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::have_work.
|
mutable |
A flag to atomically signal if the container contains work or not, how much work and the underlying lock, to assist in writing thread-safe code.
Definition at line 237 of file thread_safe_adaptors.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::clear(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::erase(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::operator=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::pop_lock(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::push_back(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::push_front(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::push_lock(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::resize_noinit_nolk(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::safe_colln(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, MLk >::sync_size().
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 224 of file thread_safe_adaptors.hpp.