MySQL 9.1.0
Source Code Documentation
s_mysql_thread_cleanup_register Struct Reference

Thread cleanup service allows a OS thread to free resources allocated for specific thread, during thread exit. More...

#include <thread_cleanup_register.h>

Public Attributes

mysql_service_status_t(* register_cleanup )(char const *component_name)
 Enable thread cleanup for calling thread. More...
 

Detailed Description

Thread cleanup service allows a OS thread to free resources allocated for specific thread, during thread exit.

Component can register for thread cleanup handler, for desired OS threads.

At thread exit, the service 'thread_cleanup_handler' implemented by the component is invoked by MySQL server.

thread cleanup.

The service can be instantiated using the registry service with the "thread_cleanup_register" name.

my_service<SERVICE_TYPE(thread_cleanup_register)>
svc("thread_cleanup_register", registry);
if (svc.is_valid()) {
// The service is ready to be used
}
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
const mysql_service_registry_t * mysql_plugin_registry_acquire()
Returns a new reference to the "registry" service.
Definition: plugin_registry_service.cc:47

The code below demonstrates way to register thread cleanup for a thread from a component. Note that we cannot deregister thread cleanup event. In case the component is uninstalled, then the thread cleanup is NO-OP.

svc->register_cleanup("implementation_name");

Member Data Documentation

◆ register_cleanup

mysql_service_status_t(* s_mysql_thread_cleanup_register::register_cleanup) (char const *component_name)

Enable thread cleanup for calling thread.

Parameters
[in]component_nameMust be same as the implementation name used for thread_cleanup_handler service.
Returns
The function always fail and return TRUE value.

The documentation for this struct was generated from the following file: