Evo C++ Library v0.5.1
|
#include <evo/process.h>
Process signal handling.
main()
errno
– especially in Linux/UnixExample using Signal::Main helper for a common case:
Here's the same code without the helper:
Classes | |
struct | Main |
Helper for common shutdown signal handling in program main() . More... | |
struct | MainServer |
Helper for common server shutdown signal handling in program main() . More... | |
Public Types | |
enum | Action { aDEFAULT, aIGNORE } |
Signal handling action. More... | |
typedef void(* | Handler) (SigNumType, Type) |
Signal handler function type More... | |
typedef void(* | OnShutdown) (SigNumType, Type) |
General shutdown handler type. More... | |
typedef int | SigNumType |
Signal number value type. More... | |
enum | Type { tUNKNOWN = 0, tINTERRUPT, tTERMINATE, tPIPE, tCHILD, tHUP, tUSER1, tUSER2, tWIN_BREAK, tWIN_CLOSE, tWIN_LOGOFF, tWIN_SHUTDOWN } |
Signal type. More... | |
Static Public Member Functions | |
static bool | send_signal (ProcessId pid, Type signal) |
Send signal to current process. More... | |
static bool | set_handler (Type type, Action action) |
Set signal handling option. More... | |
static bool | set_handler (Type type, Handler handler) |
Set signal handler. More... | |
static bool | set_on_shutdown (OnShutdown on_shutdown) |
Set shutdown handler. More... | |
static void | shutdown_sync () |
Sync shutdown with signal handler. More... | |
typedef void(* Handler) (SigNumType, Type) |
Signal handler function type
typedef void(* OnShutdown) (SigNumType, Type) |
General shutdown handler type.
typedef int SigNumType |
Signal number value type.
enum Action |
enum Type |
Signal type.
Send signal to current process.
pid | Process ID or process group ID to send to |
signal | Signal type to send |
Set signal handling option.
type | Signal type |
action | Action for signal |
Set signal handler.
type | Signal type |
handler | Handler for signal type, NULL to make sure main handler is installed without setting a user defined handler |
|
inlinestatic |
Set shutdown handler.
main()
right before it returns – this is required for graceful shutdown to work correctly in Windowson_shutdown
|
inlinestatic |
Sync shutdown with signal handler.
main()
exits, to notify that the process has shut down