MySQL 8.3.0
Source Code Documentation
Commit_stage_manager::Mutex_queue Class Reference

#include <rpl_commit_stage_manager.h>

Public Member Functions

 Mutex_queue ()
 
void init (mysql_mutex_t *lock)
 
bool is_empty () const
 
bool append (THD *first)
 Append a linked list of threads to the queue. More...
 
THDfetch_and_empty_acquire_lock ()
 Fetch the entire queue for a stage. More...
 
THDfetch_and_empty_skip_acquire_lock ()
 Fetch the entire queue for a stage. More...
 
std::pair< bool, THD * > pop_front ()
 Remove first member from the queue. More...
 
int32 get_size ()
 Get number of elements in the queue. More...
 
THDget_leader ()
 Fetch the first thread of the queue. More...
 
void lock ()
 
void unlock ()
 
void assert_owner ()
 

Private Member Functions

THDfetch_and_empty ()
 Fetch the entire queue for a stage. More...
 

Private Attributes

THDm_first
 Pointer to the first thread in the queue, or nullptr if the queue is empty. More...
 
THD ** m_last
 Pointer to the location holding the end of the queue. More...
 
std::atomic< int32m_size
 size of the queue More...
 
mysql_mutex_tm_lock
 Lock for protecting the queue. More...
 

Friends

class Commit_stage_manager
 

Constructor & Destructor Documentation

◆ Mutex_queue()

Commit_stage_manager::Mutex_queue::Mutex_queue ( )
inline

Member Function Documentation

◆ append()

bool Commit_stage_manager::Mutex_queue::append ( THD first)

Append a linked list of threads to the queue.

Parameters
[in]firstLinked list of threads to be appended to queue
Return values
trueThe queue was empty before this operation.
falseThe queue was non-empty before this operation.

◆ assert_owner()

void Commit_stage_manager::Mutex_queue::assert_owner ( )
inline

◆ fetch_and_empty()

THD * Commit_stage_manager::Mutex_queue::fetch_and_empty ( )
private

Fetch the entire queue for a stage.

Return values
Thiswill fetch the entire queue in one go.

◆ fetch_and_empty_acquire_lock()

THD * Commit_stage_manager::Mutex_queue::fetch_and_empty_acquire_lock ( )

Fetch the entire queue for a stage.

It is a wrapper over fetch_and_empty() and acquires queue lock before fetching and emptying the queue threads.

Returns
Pointer to the first session of the queue.

◆ fetch_and_empty_skip_acquire_lock()

THD * Commit_stage_manager::Mutex_queue::fetch_and_empty_skip_acquire_lock ( )

Fetch the entire queue for a stage.

It is a wrapper over fetch_and_empty(). The caller must acquire queue lock before calling this function.

Returns
Pointer to the first session of the queue.

◆ get_leader()

THD * Commit_stage_manager::Mutex_queue::get_leader ( )
inline

Fetch the first thread of the queue.

Returns
first thread of the queue.

◆ get_size()

int32 Commit_stage_manager::Mutex_queue::get_size ( )
inline

Get number of elements in the queue.

Return values
Returnsnumber of element in the queue.

◆ init()

void Commit_stage_manager::Mutex_queue::init ( mysql_mutex_t lock)
inline

◆ is_empty()

bool Commit_stage_manager::Mutex_queue::is_empty ( ) const
inline

◆ lock()

void Commit_stage_manager::Mutex_queue::lock ( )
inline

◆ pop_front()

std::pair< bool, THD * > Commit_stage_manager::Mutex_queue::pop_front ( )

Remove first member from the queue.

Return values
Returnsstd::pair<bool, THD *> object. The first boolean value of pair if true determines queue is not empty, and false determines queue is empty. The second value returns the first removed member.

◆ unlock()

void Commit_stage_manager::Mutex_queue::unlock ( )
inline

Friends And Related Function Documentation

◆ Commit_stage_manager

friend class Commit_stage_manager
friend

Member Data Documentation

◆ m_first

THD* Commit_stage_manager::Mutex_queue::m_first
private

Pointer to the first thread in the queue, or nullptr if the queue is empty.

◆ m_last

THD** Commit_stage_manager::Mutex_queue::m_last
private

Pointer to the location holding the end of the queue.

This is either &first, or a pointer to the next_to_commit of the last thread that is enqueued.

◆ m_lock

mysql_mutex_t* Commit_stage_manager::Mutex_queue::m_lock
private

Lock for protecting the queue.

◆ m_size

std::atomic<int32> Commit_stage_manager::Mutex_queue::m_size
private

size of the queue


The documentation for this class was generated from the following files: