3#if defined(CORELINK_USE_CONCURRENT_QUEUE)
25 template<
typename item_type>
27 :
public std::enable_shared_from_this<concurrent_queue<item_type>>
33 using queue_type = std::deque<item_type>;
38 queue_type m_queue_container;
57 m_queue_container.resize(initial_size);
76 m_queue_container.emplace_back(value);
87 return m_queue_container.front();
96 if (!m_queue_container.empty())
98 m_queue_container.pop_front();
109 m_queue_container.clear();
121 return m_queue_container.size();
131 return m_queue_container.empty();
Synchronized queue class for concurrent access.
Definition concurrent_queue.hpp:28
size_t size()
Definition concurrent_queue.hpp:118
concurrent_queue()=default
Construct a queue object.
concurrent_queue< item_type > & clear()
clears the queue
Definition concurrent_queue.hpp:106
bool empty()
Definition concurrent_queue.hpp:128
void pop()
drops item from the container based on the key
Definition concurrent_queue.hpp:93
virtual ~concurrent_queue()
Destroy the synchronized queue object.
Definition concurrent_queue.hpp:63
concurrent_queue< item_type > & push(const item_type &value)
adds item to the container
Definition concurrent_queue.hpp:73
item_type & peek()
Definition concurrent_queue.hpp:84
concurrent_queue(size_t initial_size)
Construct a queue object with an initial size.
Definition concurrent_queue.hpp:55
std::shared_mutex reader_writer_mutex
Definition reader_writer_lock_shim.hpp:13
std::shared_lock< reader_writer_mutex > reader_lock
Definition reader_writer_lock_shim.hpp:14
std::lock_guard< reader_writer_mutex > writer_lock
Definition reader_writer_lock_shim.hpp:22
Definition reader_writer_lock_shim.hpp:7