4#include <xrpl/basics/base_uint.h>
6#include <condition_variable>
29 mutable std::mutex m_;
30 std::condition_variable cv_;
54 std::unique_lock lck(m_);
55 cv_.wait(lck, [
this]() {
return queue_.size() <= maxSize_; });
70 std::unique_lock lck(m_);
71 cv_.wait(lck, [
this]() {
return queue_.size() <= maxSize_; });
72 queue_.push(std::move(elt));
86 std::unique_lock lck(m_);
87 cv_.wait(lck, [
this]() {
return !queue_.empty(); });
89 T ret = std::move(queue_.front());
104 std::scoped_lock
const lck(m_);
108 T ret = std::move(queue_.front());
123 return queue_.size();
133std::vector<ripple::uint256>
134getMarkers(
size_t numMarkers);
std::optional< T > tryPop()
Attempt to pop an element.
Definition ETLHelpers.hpp:102
std::size_t size() const
Get the size of the queue.
Definition ETLHelpers.hpp:121
void push(T &&elt)
Push element onto the queue.
Definition ETLHelpers.hpp:68
T pop()
Pop element from the queue.
Definition ETLHelpers.hpp:84
void push(T const &elt)
Push element onto the queue.
Definition ETLHelpers.hpp:52
ThreadSafeQueue(uint32_t maxSize)
Create an instance of the queue.
Definition ETLHelpers.hpp:40