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...
|
| | ThreadSafeDeque (size_t notify_size=100) |
| |
| | ThreadSafeDeque (const ThreadSafeDeque &other) |
| |
| | ThreadSafeDeque (const std::deque< T > &source) |
| |
| bool | empty () const noexcept |
| |
| void | push_back (T &&item) |
| |
| void | append_rows (std::vector< T > &&rows) |
| |
| T | pop_front () noexcept |
| |
| size_t | drain_front (std::vector< T > &out, size_t max_items) |
| | Move up to max_items rows into a caller-owned batch buffer under one lock.
|
| |
| template<typename Callback > |
| void | inspect (Callback &&callback) const |
| | Invoke callback with a synchronized copy of queued rows.
|
| |
| bool | is_waitable () const noexcept |
| | Returns true if a thread is actively pushing items to this deque.
|
| |
| void | wait () |
| |
| size_t | size () const noexcept |
| |
| void | notify_all () |
| | Tell listeners that this deque is actively being pushed to.
|
| |
| void | kill_all () |
| |
template<typename T>
class csv::internals::ThreadSafeDeque< T >
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; inspect() is the synchronized observation path for tests and diagnostics. Keep inspect() as a local ThreadSafeDeque affordance instead of promoting a generic queue-view type into the parser queue concept.
Definition at line 35 of file thread_safe_deque.hpp.
template<typename T >
template<typename Callback >
Invoke callback with a synchronized copy of queued rows.
Intended for tests and diagnostics that need stable indexed observation without exposing unsynchronized random access. The plain vector snapshot is deliberate: callers do not need to know whether the underlying queue is batch-backed, and RowDequeLike should not grow a custom inspection-view abstraction.
Definition at line 141 of file thread_safe_deque.hpp.