Manage signal handlers. More...
Typedefs | |
typedef void(* | GNUNET_SIGNAL_Handler) (void) |
A signal handler. More... | |
Functions | |
struct GNUNET_SIGNAL_Context * | GNUNET_SIGNAL_handler_install (int signal, GNUNET_SIGNAL_Handler handler) |
Install a signal handler that will be run if the given signal is received. More... | |
void | GNUNET_SIGNAL_handler_uninstall (struct GNUNET_SIGNAL_Context *ctx) |
Uninstall a previously installed signal handler. More... | |
void | GNUNET_SIGNAL_raise (const int sig) |
Raise the given signal by calling the installed signal handlers. More... | |
Manage signal handlers.
typedef void(* GNUNET_SIGNAL_Handler) (void) |
A signal handler.
Since different OSes have different signatures for their handlers, the API only gives the most restrictive signature – no arguments, no return value. Note that this will work even if the OS expects a function with arguments. However, the implementation must guarantee that this handler is not called for signals other than the one that it has been registered for.
Definition at line 66 of file gnunet_signal_lib.h.
struct GNUNET_SIGNAL_Context * GNUNET_SIGNAL_handler_install | ( | int | signal, |
GNUNET_SIGNAL_Handler | handler | ||
) |
Install a signal handler that will be run if the given signal is received.
signal | the number of the signal |
handler | the function to call |
Definition at line 52 of file signal.c.
References GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, ret, sc_head, and sc_tail.
Referenced by child_management_start(), GNUNET_SCHEDULER_driver_init(), and main().
void GNUNET_SIGNAL_handler_uninstall | ( | struct GNUNET_SIGNAL_Context * | ctx | ) |
Uninstall a previously installed signal handler.
ctx | context that was returned when the signal handler was installed |
Definition at line 78 of file signal.c.
References ctx, GNUNET_CONTAINER_DLL_remove, GNUNET_free, sc_head, and sc_tail.
Referenced by child_management_done(), GNUNET_SCHEDULER_driver_done(), and main().
void GNUNET_SIGNAL_raise | ( | const int | sig | ) |
Raise the given signal by calling the installed signal handlers.
This will not use the raise() system call but only calls the handlers registered through GNUNET_SIGNAL_handler_install().
sig | the signal to raise |
Definition at line 98 of file signal.c.
References ctx, sc_head, and GNUNET_SIGNAL_Context::sig.
Referenced by parent_control_handler().