sigQuit.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::sigQuit
29 
30 Description
31  Signal handler for QUIT interrupt.
32 
33  The standard interrupt handler is overridden to ensure that the
34  runningJob file is removed.
35  Can be used either directly through the static member functions or
36  through the scope of the object (constructor sets trapping; destructor
37  restores original).
38 
39 See also
40  Foam::JobInfo
41 
42 SourceFiles
43  sigQuit.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef sigQuit_H
48 #define sigQuit_H
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class sigQuit Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class sigQuit
60 {
61  // Private Data
62 
63  //- Signal trapping enabled?
64  static bool sigActive_;
65 
66 
67  // Private Member Functions
68 
69  //- Handler for caught signals
70  static void sigHandler(int);
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct null
78  sigQuit();
79 
80 
81  //- Destructor
82  ~sigQuit();
83 
84 
85  // Member Functions
86 
87  //- Activate SIGQUIT signal handler
88  static void set(bool verbose=false);
89 
90  //- Deactivate SIGQUIT signal handler
91  static void unset(bool verbose=false);
92 };
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace Foam
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 #endif
102 
103 // ************************************************************************* //
Foam::sigQuit::~sigQuit
~sigQuit()
Destructor.
Definition: sigQuit.C:68
Foam::sigQuit::unset
static void unset(bool verbose=false)
Deactivate SIGQUIT signal handler.
Definition: sigQuit.C:88
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sigQuit
Signal handler for QUIT interrupt.
Definition: sigQuit.H:58
Foam::sigQuit::set
static void set(bool verbose=false)
Activate SIGQUIT signal handler.
Definition: sigQuit.C:76
Foam::sigQuit::sigQuit
sigQuit()
Construct null.
Definition: sigQuit.C:60