MySQL 9.1.0
Source Code Documentation
service_thd_wait.h File Reference

This service provides functions for plugins and storage engines to report when they are going to sleep/stall. More...

#include <assert.h>

Go to the source code of this file.

Classes

struct  thd_wait_service_st
 

Enumerations

enum  THD_wait_type : int {
  THD_WAIT_NONE = 0 , THD_WAIT_SLEEP = 1 , THD_WAIT_DISKIO = 2 , THD_WAIT_ROW_LOCK = 3 ,
  THD_WAIT_GLOBAL_LOCK = 4 , THD_WAIT_META_DATA_LOCK = 5 , THD_WAIT_TABLE_LOCK = 6 , THD_WAIT_USER_LOCK = 7 ,
  THD_WAIT_BINLOG = 8 , THD_WAIT_GROUP_COMMIT = 9 , THD_WAIT_SYNC = 10 , THD_WAIT_TRX_DELAY = 11 ,
  THD_WAIT_LAST = 12
}
 

Functions

const char * THD_wait_type_str (THD_wait_type twt)
 
void thd_wait_begin (THD *thd, int wait_type)
 
void thd_wait_end (THD *thd)
 

Detailed Description

This service provides functions for plugins and storage engines to report when they are going to sleep/stall.

SYNOPSIS thd_wait_begin() - call just before a wait begins thd Thread object Use NULL if the thd is NOT known. wait_type Type of wait 1 – short wait (e.g. for mutex) 2 – medium wait (e.g. for disk io) 3 – large wait (e.g. for locked row/table) NOTES This is used by the threadpool to have better knowledge of which threads that currently are actively running on CPUs. When a thread reports that it's going to sleep/stall, the threadpool scheduler is free to start another thread in the pool most likely. The expected wait time is simply an indication of how long the wait is expected to become, the real wait time could be very different.

thd_wait_end() called immediately after the wait is complete

thd_wait_end() MUST be called if thd_wait_begin() was called.

Using thd_wait_...() service is optional but recommended. Using it will improve performance as the thread pool will be more active at managing the thread workload.

Enumeration Type Documentation

◆ THD_wait_type

enum THD_wait_type : int
Enumerator
THD_WAIT_NONE 
THD_WAIT_SLEEP 
THD_WAIT_DISKIO 
THD_WAIT_ROW_LOCK 
THD_WAIT_GLOBAL_LOCK 
THD_WAIT_META_DATA_LOCK 
THD_WAIT_TABLE_LOCK 
THD_WAIT_USER_LOCK 
THD_WAIT_BINLOG 
THD_WAIT_GROUP_COMMIT 
THD_WAIT_SYNC 
THD_WAIT_TRX_DELAY 
THD_WAIT_LAST 

Function Documentation

◆ thd_wait_begin()

void thd_wait_begin ( THD thd,
int  wait_type 
)

◆ thd_wait_end()

void thd_wait_end ( THD thd)

◆ THD_wait_type_str()

const char * THD_wait_type_str ( THD_wait_type  twt)
inline