FEDEM Solver  R8.0
Source code of the dynamics solver
SignalHandler.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
14 #ifndef SIGNAL_HANDLER_H
15 #define SIGNAL_HANDLER_H
16 
17 #include <string>
18 
20 typedef void (*VoidFuncPtr)();
21 
22 
28 {
29 public:
35  static void init (const char* program,
36  VoidFuncPtr f1 = NULL,
37  VoidFuncPtr f2 = NULL,
38  VoidFuncPtr f3 = NULL);
39 
40 protected:
42  static void processSignal(int sig);
44  static void dummy() {}
45 
52 
53  static std::string myProgName;
54 };
55 
56 #endif
void(* VoidFuncPtr)()
Function pointer.
Definition: SignalHandler.H:20
Static class with methods for signal handling.
Definition: SignalHandler.H:28
static std::string myProgName
Name of executable.
Definition: SignalHandler.H:53
static void processSignal(int sig)
Invokes the appropriate exit method based on the given signal.
Definition: SignalHandler.C:68
static VoidFuncPtr killAllChilds
Function to invoke when sub-processes should go away also.
Definition: SignalHandler.H:51
static void init(const char *program, VoidFuncPtr f1=NULL, VoidFuncPtr f2=NULL, VoidFuncPtr f3=NULL)
Initializes the signal handler.
Definition: SignalHandler.C:28
static VoidFuncPtr emergencyExit
Function to invoke when exiting without saving.
Definition: SignalHandler.H:47
static VoidFuncPtr emergencySaveExit
Function to invoke when exiting with save.
Definition: SignalHandler.H:49
static void dummy()
Empty dummy method (used for function pointer initialization).
Definition: SignalHandler.H:44