MySQL 8.4.2
Source Code Documentation
|
This template class implements a queue that,. More...
Public Member Functions | |
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 () |
Private Attributes | |
bool | m_waiting_for_dequeue {false} |
Whether the producer waits for a dequeue event. More... | |
bool | m_waiting_for_enqueue {false} |
Whether the consumer waits for an enqueue event. More... | |
int | m_front {-1} |
Index representing the front of the ring buffer. More... | |
int | m_rear {-1} |
Index representing the rear of the ring buffer. More... | |
int | m_size {0} |
The total number of elements in the ring buffer. More... | |
std::unique_ptr< T[]> | m_ring_buffer {} |
The buffer containing the contents of the queue. More... | |
ib_mutex_t | m_mutex {} |
The queue mutex, used to lock the queue during the enqueue and dequeue operations, to ensure thread safety. More... | |
os_event_t | m_dequeue_event {} |
When the queue is full, enqueue operations wait on this event. More... | |
os_event_t | m_enqueue_event {} |
When the queue is empty, dequeue operatios wait on this event. More... | |
This template class implements a queue that,.
|
inline |
Create the queue with essential objects.
|
inline |
Deinitialize the ring buffer by deallocating memory and reset the indexes of the queue.
|
inline |
Dequeue the log block from the queue and update the indexes in the ring buffer.
[out] | lb | The log that was dequeued from the queue. |
|
inline |
Delete the queue and its essential objects.
|
inline |
|
inline |
|
inline |
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.
[in] | size | The size of the ring buffer. |
|
private |
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.
|
private |
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.
|
private |
Index representing the front of the ring buffer.
|
private |
The queue mutex, used to lock the queue during the enqueue and dequeue operations, to ensure thread safety.
|
private |
Index representing the rear of the ring buffer.
|
private |
The buffer containing the contents of the queue.
|
private |
The total number of elements in the ring buffer.
|
private |
Whether the producer waits for a dequeue event.
|
private |
Whether the consumer waits for an enqueue event.