sigSegv.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::sigSegv
29 
30 Description
31  Signal handler for SEGV 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  sigSegv.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef sigSegv_H
48 #define sigSegv_H
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class sigSegv Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class sigSegv
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  sigSegv();
79 
80 
81  //- Destructor
82  ~sigSegv();
83 
84 
85  // Member functions
86 
87  //- Activate SIGSEGV signal handler
88  static void set(bool verbose=false);
89 
90  //- Deactivate SIGSEGV 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::sigSegv
Signal handler for SEGV interrupt.
Definition: sigSegv.H:58
Foam::sigSegv::sigSegv
sigSegv()
Construct null.
Definition: sigSegv.C:57
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sigSegv::set
static void set(bool verbose=false)
Activate SIGSEGV signal handler.
Definition: sigSegv.C:73
Foam::sigSegv::unset
static void unset(bool verbose=false)
Deactivate SIGSEGV signal handler.
Definition: sigSegv.C:85
Foam::sigSegv::~sigSegv
~sigSegv()
Destructor.
Definition: sigSegv.C:65