Thread-safe queue. Particularly useful when multiple threads need to write to and/or read from a queue.
More...
#include <queue.hpp>
|
| auto | size () const noexcept |
| | Get the size of the queue.
|
| |
| auto | empty () const noexcept |
| | Check if the queue is empty.
|
| |
| void | push (T value) noexcept |
| | Push data into the queue.
|
| |
|
void | clear () noexcept |
| | Clear the queue.
|
| |
| auto | pop (std::chrono::nanoseconds wait_time={}) -> std::optional< T > |
| | Wait for given duration then pop from the queue and return the element.
|
| |
template<typename T>
class rsl::Queue< T >
Thread-safe queue. Particularly useful when multiple threads need to write to and/or read from a queue.
◆ empty()
Check if the queue is empty.
- Returns
- True if the queue is empty, otherwise false
◆ pop()
template<typename T >
| auto rsl::Queue< T >::pop |
( |
std::chrono::nanoseconds |
wait_time = {} | ) |
-> std::optional<T> |
|
inline |
Wait for given duration then pop from the queue and return the element.
- Parameters
-
| wait_time | Maximum time to wait for queue to be non-empty |
- Returns
- Data popped from the queue or error
◆ push()
Push data into the queue.
- Parameters
-
| value | Data to push into the queue |
◆ size()
Get the size of the queue.
- Returns
- Queue size
The documentation for this class was generated from the following file: