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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::sigQuit
29
30Description
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
39See also
40 Foam::JobInfo
41
42SourceFiles
43 sigQuit.C
44
45\*---------------------------------------------------------------------------*/
46
47#ifndef sigQuit_H
48#define sigQuit_H
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class sigQuit Declaration
57\*---------------------------------------------------------------------------*/
59class 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
73public:
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// ************************************************************************* //
Signal handler for QUIT interrupt.
Definition: sigQuit.H:59
static void set(bool verbose=false)
Activate SIGQUIT signal handler.
Definition: sigQuit.C:76
static void unset(bool verbose=false)
Deactivate SIGQUIT signal handler.
Definition: sigQuit.C:88
sigQuit()
Construct null.
Definition: sigQuit.C:60
~sigQuit()
Destructor.
Definition: sigQuit.C:68
Namespace for OpenFOAM.