libmoost
|
#include <hup_handler.hpp>
Public Types | |
typedef boost::function< void()> | handler_t |
Static Public Member Functions | |
static void | set (handler_t const &handler) |
Private Member Functions | |
void | register_handler () |
Static Private Member Functions | |
static hup_handler & | get_single_instance () |
static void | sighandler (int) |
Private Attributes | |
handler_t | handler_ |
struct sigaction | sa_ |
This class represent and very simple way to trap and handle hang-up signals. It is not and never was intended to be a fully fledged signal handling framework. It's only job in life is to allow you to register a handler (which can be a simple free standing function or a functor), which will be called if the posix standard SIGHUP signal is raised.
The default behaviour that a process should implement is to reload the configuration file and then use any changes found.
To use it just call it from an appropirate place in your main thread before you start any services or actions that might need clearing up on termination. It is up to you to ensure your custom handler shuts down your process. The normal action of termination will be disabled.
Definition at line 52 of file hup_handler.hpp.
typedef boost::function<void ()> moost::process::hup_handler::handler_t |
Definition at line 63 of file hup_handler.hpp.
static hup_handler& moost::process::hup_handler::get_single_instance | ( | ) | [inline, static, private] |
void moost::process::hup_handler::register_handler | ( | ) | [inline, private] |
Definition at line 89 of file hup_handler.hpp.
static void moost::process::hup_handler::set | ( | handler_t const & | handler | ) | [inline, static] |
static void moost::process::hup_handler::sighandler | ( | int | ) | [inline, static, private] |
Definition at line 77 of file hup_handler.hpp.
Definition at line 74 of file hup_handler.hpp.
struct sigaction moost::process::hup_handler::sa_ [private] |
Definition at line 88 of file hup_handler.hpp.