Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template bounded_fifo_queue

boost::log::sinks::bounded_fifo_queue — Bounded FIFO log record queueing strategy.

Synopsis

// In header: <boost/log/sinks/bounded_fifo_queue.hpp>

template<std::size_t MaxQueueSizeV, typename OverflowStrategyT> 
class bounded_fifo_queue : private OverflowStrategyT {
public:
  // construct/copy/destruct
  bounded_fifo_queue();
  template<typename ArgsT> explicit bounded_fifo_queue(ArgsT const &);

  // 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();
};

Description

The bounded_fifo_queue class is intended to be used with the asynchronous_sink frontend as a log record queueing strategy.

This strategy describes log record queueing logic. The queue has a limited capacity, upon reaching which the enqueue operation will invoke the overflow handling strategy specified in the OverflowStrategyT template parameter to handle the situation. The library provides overflow handling strategies for most common cases: drop_on_overflow will silently discard the log record, and block_on_overflow will put the enqueueing thread to wait until there is space in the queue.

The log record queue imposes no ordering over the queued elements aside from the order in which they are enqueued.

bounded_fifo_queue public construct/copy/destruct

  1. bounded_fifo_queue();
    Default constructor.
  2. template<typename ArgsT> explicit bounded_fifo_queue(ArgsT const &);
    Initializing constructor.

bounded_fifo_queue protected member functions

  1. void enqueue(record_view const & rec);
    Enqueues log record to the queue.
  2. bool try_enqueue(record_view const & rec);
    Attempts to enqueue log record to the queue.
  3. bool try_dequeue_ready(record_view & rec);
    Attempts to dequeue a log record ready for processing from the queue, does not block if the queue is empty.
  4. bool try_dequeue(record_view & rec);
    Attempts to dequeue log record from the queue, does not block if the queue is empty.
  5. bool dequeue_ready(record_view & rec);
    Dequeues log record from the queue, blocks if the queue is empty.
  6. void interrupt_dequeue();
    Wakes a thread possibly blocked in the dequeue method.

PrevUpHomeNext