|
rippled
|
Generic thread-safe queue with an optional maximum size Note, we can't use a lockfree queue here, since we need the ability to wait for an element to be added or removed from the queue. More...

Public Member Functions | |
| ThreadSafeQueue (uint32_t maxSize) | |
| ThreadSafeQueue ()=default | |
| Create a queue with no maximum size. More... | |
| void | push (T const &elt) |
| void | push (T &&elt) |
| T | pop () |
Private Attributes | |
| std::queue< T > | queue_ |
| std::mutex | m_ |
| std::condition_variable | cv_ |
| std::optional< uint32_t > | maxSize_ |
Generic thread-safe queue with an optional maximum size Note, we can't use a lockfree queue here, since we need the ability to wait for an element to be added or removed from the queue.
These waits are blocking calls.
Definition at line 105 of file ETLHelpers.h.
|
explicit |
| maxSize | maximum size of the queue. Calls that would cause the queue to exceed this size will block until free space is available |
Definition at line 116 of file ETLHelpers.h.
|
default |
Create a queue with no maximum size.
| void ripple::ThreadSafeQueue< T >::push | ( | T const & | elt | ) |
| elt | element to push onto queue if maxSize is set, this method will block until free space is available |
Definition at line 126 of file ETLHelpers.h.
| void ripple::ThreadSafeQueue< T >::push | ( | T && | elt | ) |
| elt | element to push onto queue. elt is moved from if maxSize is set, this method will block until free space is available |
Definition at line 139 of file ETLHelpers.h.
| T ripple::ThreadSafeQueue< T >::pop | ( | ) |
Definition at line 151 of file ETLHelpers.h.
|
private |
Definition at line 107 of file ETLHelpers.h.
|
mutableprivate |
Definition at line 109 of file ETLHelpers.h.
|
private |
Definition at line 110 of file ETLHelpers.h.
|
private |
Definition at line 111 of file ETLHelpers.h.
1.8.17