MySQL 9.0.0
Source Code Documentation
Per_thread_connection_handler Class Reference

This class represents the connection handling functionality that each connection is being handled in a single thread. More...

#include <connection_handler_impl.h>

Inheritance diagram for Per_thread_connection_handler:
[legend]

Public Member Functions

 Per_thread_connection_handler ()=default
 
 ~Per_thread_connection_handler () override=default
 

Static Public Member Functions

static void init ()
 
static void destroy ()
 
static void kill_blocked_pthreads ()
 Wake blocked pthreads and wait until they have terminated. More...
 
static Channel_infoblock_until_new_connection ()
 Block until a new connection arrives. More...
 
static void modify_thread_cache_size (const ulong thread_cache_size)
 Modify the thread cache size. More...
 
static ulong get_blocked_pthread_count ()
 Return blocked threads count. More...
 

Static Public Attributes

static ulong blocked_pthread_count = 0
 
static ulong slow_launch_threads = 0
 
static bool shrink_cache = false
 
static ulong max_blocked_pthreads = 0
 

Protected Member Functions

bool add_connection (Channel_info *channel_info) override
 Add a connection. More...
 
uint get_max_threads () const override
 
- Protected Member Functions inherited from Connection_handler
 Connection_handler ()=default
 
virtual ~Connection_handler ()=default
 

Private Member Functions

 Per_thread_connection_handler (const Per_thread_connection_handler &)
 
Per_thread_connection_handleroperator= (const Per_thread_connection_handler &)
 
bool check_idle_thread_and_enqueue_connection (Channel_info *channel_info)
 Check if idle threads to handle connection in thread cache. More...
 

Static Private Attributes

static std::list< Channel_info * > * waiting_channel_info_list = nullptr
 List of pending channel info objects to be picked by idle threads. More...
 
static mysql_mutex_t LOCK_thread_cache
 
static mysql_cond_t COND_thread_cache
 
static mysql_cond_t COND_flush_thread_cache
 

Detailed Description

This class represents the connection handling functionality that each connection is being handled in a single thread.

Constructor & Destructor Documentation

◆ Per_thread_connection_handler() [1/2]

Per_thread_connection_handler::Per_thread_connection_handler ( const Per_thread_connection_handler )
private

◆ Per_thread_connection_handler() [2/2]

Per_thread_connection_handler::Per_thread_connection_handler ( )
default

◆ ~Per_thread_connection_handler()

Per_thread_connection_handler::~Per_thread_connection_handler ( )
overridedefault

Member Function Documentation

◆ add_connection()

bool Per_thread_connection_handler::add_connection ( Channel_info channel_info)
overrideprotectedvirtual

Add a connection.

Parameters
channel_infoPointer to the Channel_info object.
Note
If this function is successful (returns false), the ownership of channel_info is transferred. Otherwise the caller is responsible for its destruction.
Returns
true if processing of the new connection failed, false otherwise.

Implements Connection_handler.

◆ block_until_new_connection()

Channel_info * Per_thread_connection_handler::block_until_new_connection ( )
static

Block until a new connection arrives.

Block the current pthread for reuse by new connections.

Return values
NULLToo many pthreads blocked already or shutdown in progress.
!NULLPointer to Channel_info object representing the new connection to be served by this pthread.

◆ check_idle_thread_and_enqueue_connection()

bool Per_thread_connection_handler::check_idle_thread_and_enqueue_connection ( Channel_info channel_info)
private

Check if idle threads to handle connection in thread cache.

If so enqueue the new connection to be picked by the idle thread in thread cache.

Return values
falseif idle pthread was found, else true.

◆ destroy()

void Per_thread_connection_handler::destroy ( )
static

◆ get_blocked_pthread_count()

ulong Per_thread_connection_handler::get_blocked_pthread_count ( )
static

Return blocked threads count.

◆ get_max_threads()

uint Per_thread_connection_handler::get_max_threads ( ) const
overrideprotectedvirtual
Returns
Maximum number of threads that can be created by this connection handler.

Implements Connection_handler.

◆ init()

void Per_thread_connection_handler::init ( )
static

◆ kill_blocked_pthreads()

void Per_thread_connection_handler::kill_blocked_pthreads ( )
static

Wake blocked pthreads and wait until they have terminated.

◆ modify_thread_cache_size()

void Per_thread_connection_handler::modify_thread_cache_size ( const ulong  thread_cache_size)
static

Modify the thread cache size.

Parameters
thread_cache_sizesize of thread cache.

◆ operator=()

Per_thread_connection_handler & Per_thread_connection_handler::operator= ( const Per_thread_connection_handler )
private

Member Data Documentation

◆ blocked_pthread_count

ulong Per_thread_connection_handler::blocked_pthread_count = 0
static

◆ COND_flush_thread_cache

mysql_cond_t Per_thread_connection_handler::COND_flush_thread_cache
staticprivate

◆ COND_thread_cache

mysql_cond_t Per_thread_connection_handler::COND_thread_cache
staticprivate

◆ LOCK_thread_cache

mysql_mutex_t Per_thread_connection_handler::LOCK_thread_cache
staticprivate

◆ max_blocked_pthreads

ulong Per_thread_connection_handler::max_blocked_pthreads = 0
static

◆ shrink_cache

bool Per_thread_connection_handler::shrink_cache = false
static

◆ slow_launch_threads

ulong Per_thread_connection_handler::slow_launch_threads = 0
static

◆ waiting_channel_info_list

std::list< Channel_info * > * Per_thread_connection_handler::waiting_channel_info_list = nullptr
staticprivate

List of pending channel info objects to be picked by idle threads.

Protected by LOCK_thread_cache.


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