libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
An adaptor to add thread-safety assistance, specifically for queues. More...
#include <thread_safe_adaptors.hpp>
Inherits QT.
Public Types | |
typedef QT | container_type |
The queue to be adapted, usually std::list or std::queue. 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. 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 queues are thread-safe. Note that locking them in any order reduces the likelihood of deadlock at the cost of performance. More... | |
typedef write_lock_type::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 ValRet | value_ret_type |
The type to return when removing items from the queue. More... | |
typedef lock_traits::exception_type | exception_type |
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, and 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, and 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, and 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 | queue () noexcept(noexcept(container_type()) &&noexcept(have_work_type())) FORCE_INLINE |
queue (typename have_work_type::atomic_t &) FORCE_INLINE | |
__stdcall | queue (queue const &) noexcept(false) FORCE_INLINE |
__stdcall | ~queue () noexcept(true) FORCE_INLINE |
queue &__fastcall | operator= (queue const &) 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 | front () 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 |
value_ret_type __fastcall | pop_front () 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 | clear () noexcept(false) FORCE_INLINE |
container_type const & | colln () const noexcept(true) FORCE_INLINE |
container_type & | colln () noexcept(true) FORCE_INLINE |
value_ret_type __fastcall | pop_front_nolk () noexcept(false) FORCE_INLINE |
value_type __fastcall | pop_front_1_nochk_nolk () noexcept(noexcept(have_work.remove())) FORCE_INLINE |
value_type __fastcall | pop_front_1_nochk_nosig () noexcept(true) FORCE_INLINE |
Public Attributes | |
have_work_type | have_work |
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... | |
Static Public Attributes | |
static constexpr generic_traits::memory_access_modes | memory_access_mode |
Protected Member Functions | |
virtual value_ret_type __fastcall | pop_front_nochk_nolk () noexcept(false) FORCE_INLINE |
An adaptor to add thread-safety assistance, specifically for queues.
Note that this adaptor relies on the standardised behaviour of a sequence (or an adaptor thereof) with respect to invalidating iterators when items are added to or removed from removed from the container. Basically only std::list is guaranteed to satisfy these requirements, but std::queue often does, but that is implementation-dependent. This queue operates with one big fat lock. The iterators are not exposed to assist with writing thread-safe code. 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 336 of file thread_safe_adaptors.hpp.
typedef M jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::atomic_t |
The underlying lock object to use.
Definition at line 340 of file thread_safe_adaptors.hpp.
typedef container_type::const_reference jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::const_reference |
Definition at line 347 of file thread_safe_adaptors.hpp.
typedef QT jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::container_type |
The queue to be adapted, usually std::list or std::queue.
Definition at line 338 of file thread_safe_adaptors.hpp.
typedef lock_traits::exception_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::exception_type |
Definition at line 351 of file thread_safe_adaptors.hpp.
typedef Sig jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work_type |
Used to enable functionality to atomically signal if the container contains work or not.
Definition at line 339 of file thread_safe_adaptors.hpp.
typedef MLk jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::lock_all_type |
The multi-lock type to use to ensured that operations on combined queues are thread-safe. Note that locking them in any order reduces the likelihood of deadlock at the cost of performance.
Definition at line 343 of file thread_safe_adaptors.hpp.
typedef write_lock_type::lock_traits jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::lock_traits |
Definition at line 344 of file thread_safe_adaptors.hpp.
typedef atomic_t::read_lock_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, 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 342 of file thread_safe_adaptors.hpp.
typedef container_type::reference jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::reference |
Definition at line 346 of file thread_safe_adaptors.hpp.
typedef container_type::size_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::size_type |
Definition at line 348 of file thread_safe_adaptors.hpp.
typedef api_threading_traits<lock_traits::api_type, typename lock_traits::model_type> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::thread_traits |
Definition at line 345 of file thread_safe_adaptors.hpp.
typedef ValRet jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::value_ret_type |
The type to return when removing items from the queue.
Definition at line 350 of file thread_safe_adaptors.hpp.
typedef container_type::value_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::value_type |
Definition at line 349 of file thread_safe_adaptors.hpp.
typedef WL jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::write_lock_type |
The type of write-lock to use. This allows the possibility of using a read-write lock.
Definition at line 341 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 273 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlineexplicit |
Definition at line 277 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 281 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 290 of file thread_safe_adaptors_impl.hpp.
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::BOOST_MPL_ASSERT | ( | (std::is_same< typename write_lock_type::atomic_t, atomic_t >) | ) |
|
inlinenoexcept |
Definition at line 380 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 411 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 414 of file thread_safe_adaptors.hpp.
|
inlinenoexcept |
Definition at line 304 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 372 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 325 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 294 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 435 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_nolk().
|
inlinenoexcept |
Definition at line 389 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_nochk_nolk().
|
inlinenoexcept |
Definition at line 398 of file thread_safe_adaptors_impl.hpp.
|
inlineprotectedvirtualnoexcept |
Definition at line 410 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_1_nochk_nolk().
|
inlinenoexcept |
Definition at line 418 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_nolk().
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_nolk().
|
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 376 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, 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 372 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 351 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 344 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 358 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 365 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, 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 384 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, 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 380 of file thread_safe_adaptors.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
inlinenoexcept |
Definition at line 319 of file thread_safe_adaptors_impl.hpp.
|
inlinenoexcept |
Definition at line 310 of file thread_safe_adaptors_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::have_work.
|
mutable |
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 369 of file thread_safe_adaptors.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::clear(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, lock::any_order::all< M::lock_traits::api_type, M::lock_traits::model_type, M, M > >::erase(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::erase(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_front_1_nochk_nolk(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::pop_lock(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::push_back(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::safe_colln< C, M, WL, Sig, lock::any_order::all< M::lock_traits::api_type, M::lock_traits::model_type, M, M > >::push_front(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::push_front(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::push_lock(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::queue(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::queue< QT, M, WL, Sig, ValRet, MLk >::sync_size().
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 356 of file thread_safe_adaptors.hpp.