MySQL 9.1.0
Source Code Documentation
|
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... | |
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)
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.
signal_no | The signal number to listen to |
callback | Signal handling callback |
false | registered successfully |
true | failure to register |
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.
signal_no | The signal number to listen to |
callback | Signal handling callback |
false | unregistered successfully |
true | failure to unregister |