Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <queue.hpp>
Public Member Functions | |
Queue (std::size_t max_size=0, std::string name="") | |
Queue (const Queue &)=delete | |
Queue & | operator= (const Queue &)=delete |
Queue (Queue &&)=delete | |
Queue & | operator= (Queue &&)=delete |
~Queue ()=default | |
void | push (T value) |
void | wait_and_pop (T &value) |
bool | try_pop (T &value) |
bool | empty () const |
std::size_t | size () const |
bool | in_use () const noexcept |
void | shutdown () |
Private Attributes | |
const std::size_t | m_max_size |
const std::string | m_name |
Name of this queue (for debugging only). More... | |
std::mutex | m_mutex |
std::queue< T > | m_queue |
std::condition_variable | m_data_available |
Used to signal consumers when data is available in the queue. More... | |
std::condition_variable | m_space_available |
Used to signal producers when queue is not full. More... | |
std::atomic< bool > | m_in_use {true} |
A thread-safe queue.
|
inlineexplicit |
Construct a multithreaded queue.
max_size | Maximum number of elements in the queue. Set to 0 for an unlimited size. |
name | Optional name for this queue. (Used for debugging.) |
|
delete |
|
delete |
|
default |
|
inline |
|
inlinenoexcept |
|
delete |
|
delete |
|
inline |
Push an element onto the queue. If the queue has a max size, this call will block if the queue is full.
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Used to signal consumers when data is available in the queue.
|
private |
|
private |
Maximum size of this queue. If the queue is full pushing to the queue will block.
|
mutableprivate |
|
private |
Name of this queue (for debugging only).
|
private |
|
private |
Used to signal producers when queue is not full.