23#include <xrpl/basics/base_uint.h>
25#include <condition_variable>
48 mutable std::mutex m_;
49 std::condition_variable cv_;
73 std::unique_lock lck(m_);
74 cv_.wait(lck, [
this]() {
return queue_.size() <= maxSize_; });
89 std::unique_lock lck(m_);
90 cv_.wait(lck, [
this]() {
return queue_.size() <= maxSize_; });
91 queue_.push(std::move(elt));
105 std::unique_lock lck(m_);
106 cv_.wait(lck, [
this]() {
return !queue_.empty(); });
108 T ret = std::move(queue_.front());
123 std::scoped_lock
const lck(m_);
127 T ret = std::move(queue_.front());
142 return queue_.size();
152std::vector<ripple::uint256>
153getMarkers(
size_t numMarkers);
std::optional< T > tryPop()
Attempt to pop an element.
Definition ETLHelpers.hpp:121
std::size_t size() const
Get the size of the queue.
Definition ETLHelpers.hpp:140
void push(T &&elt)
Push element onto the queue.
Definition ETLHelpers.hpp:87
T pop()
Pop element from the queue.
Definition ETLHelpers.hpp:103
void push(T const &elt)
Push element onto the queue.
Definition ETLHelpers.hpp:71
ThreadSafeQueue(uint32_t maxSize)
Create an instance of the queue.
Definition ETLHelpers.hpp:59