sigInt.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) 2018-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::sigInt
29 
30 Description
31  Signal handler for INT interrupt.
32 
33  The standard interrupt handler is overridden to ensure that the
34  runningJob file is removed.
35 
36  Can be used either directly through the static member functions or
37  through the scope of the object (constructor sets trapping; destructor
38  restores original).
39 
40 See also
41  Foam::JobInfo
42 
43 SourceFiles
44  sigInt.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef sigInt_H
49 #define sigInt_H
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class sigInt Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class sigInt
61 {
62  // Private data
63 
64  //- Signal trapping enabled?
65  static bool sigActive_;
66 
67 
68  // Private Member Functions
69 
70  static void sigHandler(int);
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct null
78  sigInt();
79 
80 
81  //- Destructor
82  ~sigInt();
83 
84 
85  // Member functions
86 
87  //- Activate SIGINT signal handler
88  static void set(bool verbose=false);
89 
90  //- Deactivate SIGINT 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::sigInt
Signal handler for INT interrupt.
Definition: sigInt.H:59
Foam::sigInt::sigInt
sigInt()
Construct null.
Definition: sigInt.C:57
Foam::sigInt::~sigInt
~sigInt()
Destructor.
Definition: sigInt.C:65
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sigInt::unset
static void unset(bool verbose=false)
Deactivate SIGINT signal handler.
Definition: sigInt.C:85
Foam::sigInt::set
static void set(bool verbose=false)
Activate SIGINT signal handler.
Definition: sigInt.C:73