...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::sinks::unbounded_ordering_queue — Unbounded ordering log record queueing strategy.
// In header: <boost/log/sinks/unbounded_ordering_queue.hpp> template<typename OrderT> class unbounded_ordering_queue { public: // construct/copy/destruct template<typename ArgsT> explicit unbounded_ordering_queue(ArgsT const &); // public member functions posix_time::time_duration get_ordering_window() const; // public static functions static posix_time::time_duration get_default_ordering_window(); // protected member functions void enqueue(record_view const &); bool try_enqueue(record_view const &); bool try_dequeue_ready(record_view &); bool try_dequeue(record_view &); bool dequeue_ready(record_view &); void interrupt_dequeue(); // private member functions void enqueue_unlocked(record_view const &); };
The unbounded_ordering_queue
class is intended to be used with the asynchronous_sink
frontend as a log record queueing strategy.
This strategy provides the following properties to the record queueing mechanism:
The queue has no size limits.
The queue has a fixed latency window. This means that each log record put into the queue will normally not be dequeued for a certain period of time.
The queue performs stable record ordering within the latency window. The ordering predicate can be specified in the OrderT
template parameter.
Since this queue has no size limits, it may grow uncontrollably if sink backends dequeue log records not fast enough. When this is an issue, it is recommended to use one of the bounded strategies.
unbounded_ordering_queue
protected member functionsvoid enqueue(record_view const & rec);Enqueues log record to the queue.
bool try_enqueue(record_view const & rec);Attempts to enqueue log record to the queue.
bool try_dequeue_ready(record_view & rec);Attempts to dequeue a log record ready for processing from the queue, does not block if no log records are ready to be processed.
bool try_dequeue(record_view & rec);Attempts to dequeue log record from the queue, does not block.
bool dequeue_ready(record_view & rec);Dequeues log record from the queue, blocks if no log records are ready to be processed.
void interrupt_dequeue();Wakes a thread possibly blocked in the
dequeue
method.