ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4HadSignalHandler.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4HadSignalHandler.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
#ifndef G4HadSignalHandler_off
27
28
#include "
G4HadSignalHandler.hh
"
29
30
namespace
G4HadSignalHandler_local
31
{
32
extern
"C"
33
{
34
void
HandleIt
(
int
i);
35
static
void
(*
G4HadSignalHandler_initial
)(
int
);
36
}
37
}
38
39
using namespace
std;
40
41
G4ThreadLocal
std::vector<sighandler_t> *
G4HadSignalHandler::theCache
= 0;
42
G4ThreadLocal
bool
G4HadSignalHandler::registered
=
false
;
43
44
G4HadSignalHandler::G4HadSignalHandler
(
sighandler_t
aNew)
45
{
46
if
(!theCache) theCache =
new
std::vector<sighandler_t>;
47
if
(!registered)
48
{
49
G4HadSignalHandler_local::G4HadSignalHandler_initial
=
50
signal(SIGSEGV,
G4HadSignalHandler_local::HandleIt
);
51
registered =
true
;
52
}
53
theCache->push_back(aNew);
54
}
55
56
G4HadSignalHandler::~G4HadSignalHandler
()
57
{
58
theCache->clear();
59
signal (SIGSEGV,
G4HadSignalHandler_local::G4HadSignalHandler_initial
);
60
registered =
false
;
61
}
62
63
void
G4HadSignalHandler_local::HandleIt
(
int
i)
64
{
65
static
G4ThreadLocal
int
*iii_p = 0 ;
66
if
(!iii_p)
67
{
68
iii_p =
new
int
;
69
*iii_p =
G4HadSignalHandler::theCache
->size()-1 ;
70
}
71
int
&iii = *iii_p;
72
for
(
int
c
=iii;
c
!=-1;
c
--)
73
{
74
iii--;
75
//Andrea Dotti (13Jan2013): change for G4MT
76
(
G4HadSignalHandler::theCache
->operator[](
c
))(i);
77
//G4HadSignalHandler::theCache[c](i);
78
}
79
std::cerr <<
"callback to user-defined or default signal handler"
<<endl;
80
signal (SIGSEGV,
G4HadSignalHandler_local::G4HadSignalHandler_initial
);
81
raise
(i);
82
}
83
84
#endif
geant4
tree
geant4-10.6-release
source
processes
hadronic
util
src
G4HadSignalHandler.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:52
using
1.8.2 with
ECCE GitHub integration