This template class implements a queue that,.
More...
|
void | create () |
| Create the queue with essential objects. More...
|
|
void | init (const int size) |
| Initialize the ring buffer by allocating memory and initialize the indexes of the queue. More...
|
|
void | deinit () |
| Deinitialize the ring buffer by deallocating memory and reset the indexes of the queue. More...
|
|
void | drop () |
| Delete the queue and its essential objects. More...
|
|
void | enqueue (const T &lb) |
|
void | dequeue (T &lb) |
| Dequeue the log block from the queue and update the indexes in the ring buffer. More...
|
|
bool | empty () |
|
template<typename
T>
class meb::Queue< T >
This template class implements a queue that,.
- Implements a Ring Buffer. 1.1 The ring buffer can store QUEUE_SIZE_MAX elements. 1.2 Each element of the ring buffer stores log blocks of size QUEUE_BLOCK_SIZE.
- Blocks for more data to be enqueued if the queue is empty.
- Blocks for data to be dequeued if the queue is full.
- Is thread safe.
◆ create()
Create the queue with essential objects.
◆ deinit()
Deinitialize the ring buffer by deallocating memory and reset the indexes of the queue.
◆ dequeue()
Dequeue the log block from the queue and update the indexes in the ring buffer.
- Parameters
-
[out] | lb | The log that was dequeued from the queue. |
◆ drop()
Delete the queue and its essential objects.
◆ empty()
◆ enqueue()
◆ init()
Initialize the ring buffer by allocating memory and initialize the indexes of the queue.
The initialization is done in a separate method so that the ring buffer is allocated memory only when redo log archiving is started.
- Parameters
-
[in] | size | The size of the ring buffer. |
◆ m_dequeue_event
When the queue is full, enqueue operations wait on this event.
When it is set, it indicates that a dequeue has happened and there is space in the queue.
◆ m_enqueue_event
When the queue is empty, dequeue operatios wait on this event.
When it is set, it indicates that a enqueue operation has happened and there is an element in the queue, that can be dequeued.
◆ m_front
Index representing the front of the ring buffer.
◆ m_mutex
The queue mutex, used to lock the queue during the enqueue and dequeue operations, to ensure thread safety.
◆ m_rear
Index representing the rear of the ring buffer.
◆ m_ring_buffer
The buffer containing the contents of the queue.
◆ m_size
The total number of elements in the ring buffer.
◆ m_waiting_for_dequeue
Whether the producer waits for a dequeue event.
◆ m_waiting_for_enqueue
Whether the consumer waits for an enqueue event.
The documentation for this class was generated from the following file: