MySQL 9.1.0
Source Code Documentation
s_mysql_my_signal_handler Struct Reference

A service to register/deregister a signal handler function callback. More...

#include <mysql_signal_handler.h>

Public Attributes

mysql_service_status_t(* add )(int signal_no, my_signal_handler_callback_t callback)
 Register a callback that will be called when mysql server component handles a fatal signal. More...
 
mysql_service_status_t(* remove )(int signal_no, my_signal_handler_callback_t callback)
 Unregister a callback that was registered. More...
 

Detailed Description

A service to register/deregister a signal handler function callback.

The server component signal handler will call this callback if a signal occurs. The callback needs to be signal reentrant safe code. Otherwise no guaranees on what happens.

Usage example: auto register_signal_handler_callback(my_signal_handler_callback_t callback) -> bool { SERVICE_PLACEHOLDER(my_signal_handler)->add(SIGSEGV, callback) == 0; } auto unregister_signal_handler_callback(my_signal_handler_callback_t callback) -> bool { return SERVICE_PLACEHOLDER(my_signal_handler)->remove(SIGSEGV, callback) == 0; }

auto handle_segfault_signal(int signum) { Code to handle segfault ... }

If this is used inside another component, at component init(): register_signal_handler_callback(&handle_segfault_signal)

At component deinit(): unregister_signal_handler_callback(&handle_segfault_signal)

See also
my_signal_handler_imp

Member Data Documentation

◆ add

mysql_service_status_t(* s_mysql_my_signal_handler::add) (int signal_no, my_signal_handler_callback_t callback)

Register a callback that will be called when mysql server component handles a fatal signal.

Note
: Each registered callback needs to be unregistered by calling remove.
Parameters
signal_noThe signal number to listen to
callbackSignal handling callback
Returns
Status of performed operation
Return values
falseregistered successfully
truefailure to register
See also
my_host_application_signal

◆ remove

mysql_service_status_t(* s_mysql_my_signal_handler::remove) (int signal_no, my_signal_handler_callback_t callback)

Unregister a callback that was registered.

Parameters
signal_noThe signal number to listen to
callbackSignal handling callback
Returns
Status of performed operation
Return values
falseunregistered successfully
truefailure to unregister
See also
my_host_application_signal

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