|
Vince's CSV Parser
|
A std::deque wrapper which allows multiple read and write threads to concurrently access it along with providing read threads the ability to wait for the deque to become populated. More...
#include <thread_safe_deque.hpp>
Public Member Functions | |
| ThreadSafeDeque (size_t notify_size=100) | |
| ThreadSafeDeque (const ThreadSafeDeque &other) | |
| ThreadSafeDeque (const std::deque< T > &source) | |
| bool | empty () const noexcept |
| T & | front () noexcept |
| T & | operator[] (size_t n) |
| NOTE: operator[] is not synchronized. | |
| void | push_back (T &&item) |
| T | pop_front () noexcept |
| constexpr bool | is_waitable () const noexcept |
| Returns true if a thread is actively pushing items to this deque. | |
| void | wait () |
| Wait for an item to become available. | |
| size_t | size () const noexcept |
| std::deque< T >::iterator | begin () noexcept |
| std::deque< T >::iterator | end () noexcept |
| void | notify_all () |
| Tell listeners that this deque is actively being pushed to. | |
| void | kill_all () |
| Tell all listeners to stop. | |
A std::deque wrapper which allows multiple read and write threads to concurrently access it along with providing read threads the ability to wait for the deque to become populated.
Concurrency strategy: writer-side mutations (push_back/pop_front) are locked; hot-path flags (empty/is_waitable) are atomic; operator[] and iterators are not synchronized and must not run concurrently with writers.
Definition at line 25 of file thread_safe_deque.hpp.
|
inline |
Definition at line 27 of file thread_safe_deque.hpp.
|
inline |
Definition at line 28 of file thread_safe_deque.hpp.
|
inline |
Definition at line 34 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 99 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 39 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 103 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 43 of file thread_safe_deque.hpp.
|
inlineconstexprnoexcept |
Returns true if a thread is actively pushing items to this deque.
Definition at line 81 of file thread_safe_deque.hpp.
|
inline |
Tell all listeners to stop.
Definition at line 114 of file thread_safe_deque.hpp.
|
inline |
Tell listeners that this deque is actively being pushed to.
Definition at line 108 of file thread_safe_deque.hpp.
|
inline |
NOTE: operator[] is not synchronized.
Only call when no concurrent push_back/pop_front can occur. std::deque can reallocate its internal map on push_back, which makes concurrent operator[] access undefined behavior.
Definition at line 53 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 67 of file thread_safe_deque.hpp.
Definition at line 57 of file thread_safe_deque.hpp.
|
inlinenoexcept |
Definition at line 94 of file thread_safe_deque.hpp.
|
inline |
Wait for an item to become available.
Definition at line 84 of file thread_safe_deque.hpp.