MySQL 9.1.0
Source Code Documentation
MDL_wait Class Reference

A reliable way to wait on an MDL lock. More...

#include <mdl.h>

Public Types

enum  enum_wait_status {
  WS_EMPTY = 0 , GRANTED , VICTIM , TIMEOUT ,
  KILLED
}
 

Public Member Functions

 MDL_wait ()
 Construct an empty wait slot. More...
 
 ~MDL_wait ()
 Destroy system resources. More...
 
bool set_status (enum_wait_status result_arg)
 Set the status unless it's already set. More...
 
enum_wait_status get_status ()
 Query the current value of the wait slot. More...
 
void reset_status ()
 Clear the current value of the wait slot. More...
 
enum_wait_status timed_wait (MDL_context_owner *owner, struct timespec *abs_timeout, bool signal_timeout, const PSI_stage_info *wait_state_name)
 Wait for the status to be assigned to this wait slot. More...
 
enum_wait_status observable_timed_wait (MDL_context_owner *owner, unsigned long abs_timeout, bool signal_timeout, std::function< void(unsigned long)> tracker_function, const PSI_stage_info *wait_state_name)
 Wait for the status to be assigned to this wait slot. More...
 

Private Attributes

mysql_mutex_t m_LOCK_wait_status
 Condvar which is used for waiting until this context's pending request can be satisfied or this thread has to perform actions to resolve a potential deadlock (we subscribe to such notification by adding a ticket corresponding to the request to an appropriate queue of waiters). More...
 
mysql_cond_t m_COND_wait_status
 
enum_wait_status m_wait_status
 

Detailed Description

A reliable way to wait on an MDL lock.

Member Enumeration Documentation

◆ enum_wait_status

Enumerator
WS_EMPTY 
GRANTED 
VICTIM 
TIMEOUT 
KILLED 

Constructor & Destructor Documentation

◆ MDL_wait()

MDL_wait::MDL_wait ( )

Construct an empty wait slot.

◆ ~MDL_wait()

MDL_wait::~MDL_wait ( )

Destroy system resources.

Member Function Documentation

◆ get_status()

MDL_wait::enum_wait_status MDL_wait::get_status ( )

Query the current value of the wait slot.

◆ observable_timed_wait()

MDL_wait::enum_wait_status MDL_wait::observable_timed_wait ( MDL_context_owner owner,
unsigned long  abs_timeout,
bool  signal_timeout,
std::function< void(unsigned long)>  tracker_function,
const PSI_stage_info wait_state_name 
)

Wait for the status to be assigned to this wait slot.

This method varies from the above as it tracks the time waited The called can collect this time on a tracker function

Parameters
ownerMDL context owner.
abs_timeouttime after which waiting should stop.
signal_timeouttrue - If in case of timeout waiting context should close the wait slot by sending TIMEOUT to itself. false - Otherwise.
tracker_functioncollects the waited time at 1 sec intervals
wait_state_nameThread state name to be set for duration of wait.
Returns
Signal posted.

◆ reset_status()

void MDL_wait::reset_status ( )

Clear the current value of the wait slot.

◆ set_status()

bool MDL_wait::set_status ( enum_wait_status  status_arg)

Set the status unless it's already set.

Return false if set, true otherwise.

◆ timed_wait()

MDL_wait::enum_wait_status MDL_wait::timed_wait ( MDL_context_owner owner,
struct timespec *  abs_timeout,
bool  set_status_on_timeout,
const PSI_stage_info wait_state_name 
)

Wait for the status to be assigned to this wait slot.

Parameters
ownerMDL context owner.
abs_timeoutAbsolute time after which waiting should stop.
set_status_on_timeouttrue - If in case of timeout waiting context should close the wait slot by sending TIMEOUT to itself. false - Otherwise.
wait_state_nameThread state name to be set for duration of wait.
Returns
Signal posted.

Member Data Documentation

◆ m_COND_wait_status

mysql_cond_t MDL_wait::m_COND_wait_status
private

◆ m_LOCK_wait_status

mysql_mutex_t MDL_wait::m_LOCK_wait_status
private

Condvar which is used for waiting until this context's pending request can be satisfied or this thread has to perform actions to resolve a potential deadlock (we subscribe to such notification by adding a ticket corresponding to the request to an appropriate queue of waiters).

◆ m_wait_status

enum_wait_status MDL_wait::m_wait_status
private

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