MySQL 8.0.31
Source Code Documentation
mysql_thread.h File Reference

Instrumentation helpers for mysys threads. More...

#include "my_psi_config.h"
#include "my_thread.h"
#include "my_thread_local.h"
#include "mysql/psi/psi_thread.h"
#include "pfs_thread_provider.h"

Go to the source code of this file.

Macros

#define mysql_thread_register(P1, P2, P3)    inline_mysql_thread_register(P1, P2, P3)
 Thread registration. More...
 
#define mysql_thread_create(K, P1, P2, P3, P4)    inline_mysql_thread_create(K, 0, P1, P2, P3, P4)
 Instrumented my_thread_create. More...
 
#define mysql_thread_create_seq(K, S, P1, P2, P3, P4)    inline_mysql_thread_create(K, S, P1, P2, P3, P4)
 Instrumented my_thread_create. More...
 
#define mysql_thread_set_psi_id(I)   inline_mysql_thread_set_psi_id(I)
 Set the thread identifier for the instrumentation. More...
 
#define mysql_thread_set_psi_THD(T)   inline_mysql_thread_set_psi_THD(T)
 Set the thread sql session for the instrumentation. More...
 

Functions

static void inline_mysql_thread_register (const char *category, PSI_thread_info *info, int count)
 
static int inline_mysql_thread_create (PSI_thread_key key, unsigned int sequence_number, my_thread_handle *thread, const my_thread_attr_t *attr, my_start_routine start_routine, void *arg)
 
static void inline_mysql_thread_set_psi_id (my_thread_id id)
 
static void inline_mysql_thread_set_psi_THD (THD *thd)
 
static void mysql_thread_set_peer_port (uint port)
 
static void mysql_thread_set_secondary_engine (bool secondary)
 

Detailed Description

Instrumentation helpers for mysys threads.

This header file provides the necessary declarations to use the mysys thread API with the performance schema instrumentation. In some compilers (SunStudio), 'static inline' functions, when declared but not used, are not optimized away (because they are unused) by default, so that including a static inline function from a header file does create unwanted dependencies, causing unresolved symbols at link time. Other compilers, like gcc, optimize these dependencies by default.

Since the instrumented APIs declared here are wrapper on top of my_thread / safemutex / etc APIs, including mysql/psi/mysql_thread.h assumes that the dependency on my_thread and safemutex already exists.