mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: signals: refactored to make static methods
The signal handling can now be set and unset. This latter is important for external libraries (e.g. VTK/OpenGL) that do not work with it.
This commit is contained in:
@ -45,6 +45,8 @@ License
|
|||||||
|
|
||||||
struct sigaction Foam::sigFpe::oldAction_;
|
struct sigaction Foam::sigFpe::oldAction_;
|
||||||
|
|
||||||
|
bool Foam::sigFpe::sigFpeActive_ = false;
|
||||||
|
|
||||||
void Foam::sigFpe::fillNan(UList<scalar>& lst)
|
void Foam::sigFpe::fillNan(UList<scalar>& lst)
|
||||||
{
|
{
|
||||||
lst = std::numeric_limits<scalar>::signaling_NaN();
|
lst = std::numeric_limits<scalar>::signaling_NaN();
|
||||||
@ -114,7 +116,7 @@ void Foam::sigFpe::sigHandler(int)
|
|||||||
|
|
||||||
Foam::sigFpe::sigFpe()
|
Foam::sigFpe::sigFpe()
|
||||||
{
|
{
|
||||||
oldAction_.sa_handler = NULL;
|
set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,28 +124,7 @@ Foam::sigFpe::sigFpe()
|
|||||||
|
|
||||||
Foam::sigFpe::~sigFpe()
|
Foam::sigFpe::~sigFpe()
|
||||||
{
|
{
|
||||||
if (env("FOAM_SIGFPE"))
|
unset(false);
|
||||||
{
|
|
||||||
#ifdef LINUX_GNUC
|
|
||||||
// Reset signal
|
|
||||||
if (oldAction_.sa_handler && sigaction(SIGFPE, &oldAction_, NULL) < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigFpe::~sigFpe()"
|
|
||||||
) << "Cannot reset SIGFPE trapping"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env("FOAM_SETNAN"))
|
|
||||||
{
|
|
||||||
#ifdef LINUX
|
|
||||||
// Disable initialization to NaN
|
|
||||||
mallocNanActive_ = false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,16 +132,7 @@ Foam::sigFpe::~sigFpe()
|
|||||||
|
|
||||||
void Foam::sigFpe::set(const bool verbose)
|
void Foam::sigFpe::set(const bool verbose)
|
||||||
{
|
{
|
||||||
if (oldAction_.sa_handler)
|
if (!sigFpeActive_ && env("FOAM_SIGFPE"))
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigFpe::set()"
|
|
||||||
) << "Cannot call sigFpe::set() more than once"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env("FOAM_SIGFPE"))
|
|
||||||
{
|
{
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
|
|
||||||
@ -187,6 +159,7 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sigFpeActive_ = true;
|
||||||
|
|
||||||
#elif defined(sgiN32) || defined(sgiN32Gcc)
|
#elif defined(sgiN32) || defined(sgiN32Gcc)
|
||||||
supported = true;
|
supported = true;
|
||||||
@ -209,6 +182,9 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
_ABORT_ON_ERROR,
|
_ABORT_ON_ERROR,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sigFpeActive_ = true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -251,4 +227,52 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sigFpe::unset(const bool verbose)
|
||||||
|
{
|
||||||
|
#ifdef LINUX_GNUC
|
||||||
|
// Reset signal
|
||||||
|
if (sigFpeActive_)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "sigFpe : Disabling floating point exception trapping"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sigaction(SIGFPE, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigFpe::unset(const bool)"
|
||||||
|
) << "Cannot reset SIGFPE trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset exception raising
|
||||||
|
int oldExcept = fedisableexcept
|
||||||
|
(
|
||||||
|
FE_DIVBYZERO
|
||||||
|
| FE_INVALID
|
||||||
|
| FE_OVERFLOW
|
||||||
|
);
|
||||||
|
|
||||||
|
if (oldExcept == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"sigFpe::unset(const bool)"
|
||||||
|
) << "Cannot reset SIGFPE trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
sigFpeActive_ = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LINUX
|
||||||
|
// Disable initialization to NaN
|
||||||
|
mallocNanActive_ = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -35,6 +35,10 @@ Description
|
|||||||
also set, this will cause usage of uninitialized scalars to trigger
|
also set, this will cause usage of uninitialized scalars to trigger
|
||||||
an abort.
|
an abort.
|
||||||
|
|
||||||
|
Can be used either directly through the static member functions or
|
||||||
|
through the scope of the object (constructor sets trapping; destructor
|
||||||
|
restores original).
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
sigFpe.C
|
sigFpe.C
|
||||||
|
|
||||||
@ -72,6 +76,9 @@ class sigFpe
|
|||||||
//- Saved old signal trapping setting
|
//- Saved old signal trapping setting
|
||||||
static struct sigaction oldAction_;
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
//- Flag to indicate floating point trapping is enabled
|
||||||
|
static bool sigFpeActive_;
|
||||||
|
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
@ -98,7 +105,10 @@ public:
|
|||||||
|
|
||||||
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
|
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
|
||||||
// Fill memory with NaN when FOAM_SETNAN is %set
|
// Fill memory with NaN when FOAM_SETNAN is %set
|
||||||
void set(const bool verbose);
|
static void set(const bool verbose);
|
||||||
|
|
||||||
|
//- Deactivate SIGFPE signal handler and NaN memory initialisation
|
||||||
|
static void unset(const bool verbose);
|
||||||
|
|
||||||
//- Flag to indicate mallocNan is enabled
|
//- Flag to indicate mallocNan is enabled
|
||||||
static bool mallocNanActive_;
|
static bool mallocNanActive_;
|
||||||
|
|||||||
@ -32,6 +32,8 @@ License
|
|||||||
|
|
||||||
struct sigaction Foam::sigInt::oldAction_;
|
struct sigaction Foam::sigInt::oldAction_;
|
||||||
|
|
||||||
|
bool Foam::sigInt::sigActive_ = false;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ void Foam::sigInt::sigHandler(int)
|
|||||||
|
|
||||||
Foam::sigInt::sigInt()
|
Foam::sigInt::sigInt()
|
||||||
{
|
{
|
||||||
oldAction_.sa_handler = NULL;
|
set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,15 +69,7 @@ Foam::sigInt::sigInt()
|
|||||||
|
|
||||||
Foam::sigInt::~sigInt()
|
Foam::sigInt::~sigInt()
|
||||||
{
|
{
|
||||||
// Reset old handling
|
unset(false);
|
||||||
if (sigaction(SIGINT, &oldAction_, NULL) < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigInt::~sigInt()"
|
|
||||||
) << "Cannot reset SIGINT trapping"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,15 +77,8 @@ Foam::sigInt::~sigInt()
|
|||||||
|
|
||||||
void Foam::sigInt::set(const bool)
|
void Foam::sigInt::set(const bool)
|
||||||
{
|
{
|
||||||
if (oldAction_.sa_handler)
|
if (!sigActive_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigInt::set()"
|
|
||||||
) << "Cannot call sigInt::set() more than once"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sigaction newAction;
|
struct sigaction newAction;
|
||||||
newAction.sa_handler = sigHandler;
|
newAction.sa_handler = sigHandler;
|
||||||
newAction.sa_flags = SA_NODEFER;
|
newAction.sa_flags = SA_NODEFER;
|
||||||
@ -104,6 +91,25 @@ void Foam::sigInt::set(const bool)
|
|||||||
) << "Cannot set SIGINT trapping"
|
) << "Cannot set SIGINT trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
sigActive_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sigInt::unset(const bool)
|
||||||
|
{
|
||||||
|
if (sigActive_)
|
||||||
|
{
|
||||||
|
if (sigaction(SIGINT, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigInt::unset()"
|
||||||
|
) << "Cannot reset SIGINT trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
sigActive_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,10 @@ Description
|
|||||||
The standard interupt handler is overridden to ensure that the
|
The standard interupt handler is overridden to ensure that the
|
||||||
runningJob file is removed.
|
runningJob file is removed.
|
||||||
|
|
||||||
|
Can be used either directly through the static member functions or
|
||||||
|
through the scope of the object (constructor sets trapping; destructor
|
||||||
|
restores original).
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::JobInfo
|
Foam::JobInfo
|
||||||
|
|
||||||
@ -59,6 +63,9 @@ class sigInt
|
|||||||
//- Saved old signal trapping setting
|
//- Saved old signal trapping setting
|
||||||
static struct sigaction oldAction_;
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
//- Flag to indicate signal trapping is enabled
|
||||||
|
static bool sigActive_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -80,7 +87,10 @@ public:
|
|||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Activate SIGINT signal handler
|
//- Activate SIGINT signal handler
|
||||||
void set(const bool verbose);
|
static void set(const bool verbose);
|
||||||
|
|
||||||
|
//- Deactivate SIGINT signal handler
|
||||||
|
static void unset(const bool verbose);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,8 @@ License
|
|||||||
|
|
||||||
struct sigaction Foam::sigQuit::oldAction_;
|
struct sigaction Foam::sigQuit::oldAction_;
|
||||||
|
|
||||||
|
bool Foam::sigQuit::sigActive_ = false;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ void Foam::sigQuit::sigHandler(int)
|
|||||||
|
|
||||||
Foam::sigQuit::sigQuit()
|
Foam::sigQuit::sigQuit()
|
||||||
{
|
{
|
||||||
oldAction_.sa_handler = NULL;
|
set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,15 +71,7 @@ Foam::sigQuit::sigQuit()
|
|||||||
|
|
||||||
Foam::sigQuit::~sigQuit()
|
Foam::sigQuit::~sigQuit()
|
||||||
{
|
{
|
||||||
// Reset old handling
|
unset(false);
|
||||||
if (oldAction_.sa_handler && sigaction(SIGQUIT, &oldAction_, NULL) < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigQuit::~sigQuit()"
|
|
||||||
) << "Cannot reset SIGQUIT trapping"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,15 +79,8 @@ Foam::sigQuit::~sigQuit()
|
|||||||
|
|
||||||
void Foam::sigQuit::set(const bool verbose)
|
void Foam::sigQuit::set(const bool verbose)
|
||||||
{
|
{
|
||||||
if (oldAction_.sa_handler)
|
if (!sigActive_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigQuit::set()"
|
|
||||||
) << "Cannot call sigQuit::set() more than once"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sigaction newAction;
|
struct sigaction newAction;
|
||||||
newAction.sa_handler = sigHandler;
|
newAction.sa_handler = sigHandler;
|
||||||
newAction.sa_flags = SA_NODEFER;
|
newAction.sa_flags = SA_NODEFER;
|
||||||
@ -106,6 +93,25 @@ void Foam::sigQuit::set(const bool verbose)
|
|||||||
) << "Cannot set SIGQUIT trapping"
|
) << "Cannot set SIGQUIT trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
sigActive_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sigQuit::unset(const bool)
|
||||||
|
{
|
||||||
|
if (sigActive_)
|
||||||
|
{
|
||||||
|
if (sigaction(SIGQUIT, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigQuit::unset()"
|
||||||
|
) << "Cannot reset SIGQUIT trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
sigActive_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,9 @@ Description
|
|||||||
|
|
||||||
The standard interupt handler is overridden to ensure that the
|
The standard interupt handler is overridden to ensure that the
|
||||||
runningJob file is removed.
|
runningJob file is removed.
|
||||||
|
Can be used either directly through the static member functions or
|
||||||
|
through the scope of the object (constructor sets trapping; destructor
|
||||||
|
restores original).
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::JobInfo
|
Foam::JobInfo
|
||||||
@ -59,6 +62,9 @@ class sigQuit
|
|||||||
//- Saved old signal trapping setting
|
//- Saved old signal trapping setting
|
||||||
static struct sigaction oldAction_;
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
//- Flag to indicate signal trapping is enabled
|
||||||
|
static bool sigActive_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -81,7 +87,10 @@ public:
|
|||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Activate SIGQUIT signal handler
|
//- Activate SIGQUIT signal handler
|
||||||
void set(const bool verbose);
|
static void set(const bool verbose);
|
||||||
|
|
||||||
|
//- Deactivate SIGQUIT signal handler
|
||||||
|
static void unset(const bool verbose);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,8 @@ License
|
|||||||
|
|
||||||
struct sigaction Foam::sigSegv::oldAction_;
|
struct sigaction Foam::sigSegv::oldAction_;
|
||||||
|
|
||||||
|
bool Foam::sigSegv::sigActive_ = false;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ void Foam::sigSegv::sigHandler(int)
|
|||||||
|
|
||||||
Foam::sigSegv::sigSegv()
|
Foam::sigSegv::sigSegv()
|
||||||
{
|
{
|
||||||
oldAction_.sa_handler = NULL;
|
set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,15 +71,7 @@ Foam::sigSegv::sigSegv()
|
|||||||
|
|
||||||
Foam::sigSegv::~sigSegv()
|
Foam::sigSegv::~sigSegv()
|
||||||
{
|
{
|
||||||
// Reset old handling
|
unset(false);
|
||||||
if (sigaction(SIGSEGV, &oldAction_, NULL) < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigSegv::~sigSegv()"
|
|
||||||
) << "Cannot reset SIGSEGV trapping"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,15 +79,8 @@ Foam::sigSegv::~sigSegv()
|
|||||||
|
|
||||||
void Foam::sigSegv::set(const bool)
|
void Foam::sigSegv::set(const bool)
|
||||||
{
|
{
|
||||||
if (oldAction_.sa_handler)
|
if (!sigActive_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::sigSegv::set()"
|
|
||||||
) << "Cannot call sigSegv::set() more than once"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sigaction newAction;
|
struct sigaction newAction;
|
||||||
newAction.sa_handler = sigHandler;
|
newAction.sa_handler = sigHandler;
|
||||||
newAction.sa_flags = SA_NODEFER;
|
newAction.sa_flags = SA_NODEFER;
|
||||||
@ -106,6 +93,25 @@ void Foam::sigSegv::set(const bool)
|
|||||||
) << "Cannot set SIGSEGV trapping"
|
) << "Cannot set SIGSEGV trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
sigActive_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sigSegv::unset(const bool)
|
||||||
|
{
|
||||||
|
if (sigActive_)
|
||||||
|
{
|
||||||
|
if (sigaction(SIGSEGV, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigSegv::unset()"
|
||||||
|
) << "Cannot reset SIGSEGV trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
sigActive_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,9 @@ Description
|
|||||||
|
|
||||||
The standard interupt handler is overridden to ensure that the
|
The standard interupt handler is overridden to ensure that the
|
||||||
runningJob file is removed.
|
runningJob file is removed.
|
||||||
|
Can be used either directly through the static member functions or
|
||||||
|
through the scope of the object (constructor sets trapping; destructor
|
||||||
|
restores original).
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::JobInfo
|
Foam::JobInfo
|
||||||
@ -59,6 +62,9 @@ class sigSegv
|
|||||||
//- Saved old signal trapping setting
|
//- Saved old signal trapping setting
|
||||||
static struct sigaction oldAction_;
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
//- Flag to indicate signal trapping is enabled
|
||||||
|
static bool sigActive_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -81,7 +87,10 @@ public:
|
|||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Activate SIGSEGV signal handler
|
//- Activate SIGSEGV signal handler
|
||||||
void set(const bool verbose);
|
static void set(const bool verbose);
|
||||||
|
|
||||||
|
//- Deactivate SIGSEGV signal handler
|
||||||
|
static void unset(const bool verbose);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,10 @@ License
|
|||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
#include "dynamicCode.H"
|
#include "dynamicCode.H"
|
||||||
|
#include "sigFpe.H"
|
||||||
|
#include "sigInt.H"
|
||||||
|
#include "sigQuit.H"
|
||||||
|
#include "sigSegv.H"
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
@ -868,10 +872,10 @@ void Foam::argList::parse
|
|||||||
|
|
||||||
// Switch on signal trapping. We have to wait until after Pstream::init
|
// Switch on signal trapping. We have to wait until after Pstream::init
|
||||||
// since this sets up its own ones.
|
// since this sets up its own ones.
|
||||||
sigFpe_.set(bannerEnabled);
|
sigFpe::set(bannerEnabled);
|
||||||
sigInt_.set(bannerEnabled);
|
sigInt::set(bannerEnabled);
|
||||||
sigQuit_.set(bannerEnabled);
|
sigQuit::set(bannerEnabled);
|
||||||
sigSegv_.set(bannerEnabled);
|
sigSegv::set(bannerEnabled);
|
||||||
|
|
||||||
if (bannerEnabled)
|
if (bannerEnabled)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -86,11 +86,6 @@ SourceFiles
|
|||||||
#include "IStringStream.H"
|
#include "IStringStream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
#include "sigFpe.H"
|
|
||||||
#include "sigInt.H"
|
|
||||||
#include "sigQuit.H"
|
|
||||||
#include "sigSegv.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -118,12 +113,6 @@ class argList
|
|||||||
fileName case_;
|
fileName case_;
|
||||||
string argListStr_;
|
string argListStr_;
|
||||||
|
|
||||||
// Signal handlers
|
|
||||||
sigFpe sigFpe_;
|
|
||||||
sigInt sigInt_;
|
|
||||||
sigQuit sigQuit_;
|
|
||||||
sigSegv sigSegv_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "surface.H"
|
#include "surface.H"
|
||||||
#include "text.H"
|
#include "text.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "sigFpe.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkPolyDataMapper.h"
|
#include "vtkPolyDataMapper.h"
|
||||||
@ -143,6 +144,10 @@ void Foam::runTimePostProcessing::write()
|
|||||||
Info<< type() << " " << name_ << " output:" << nl
|
Info<< type() << " " << name_ << " output:" << nl
|
||||||
<< " Constructing scene" << endl;
|
<< " Constructing scene" << endl;
|
||||||
|
|
||||||
|
// Unset any floating point trapping (some low-level rendering functionality
|
||||||
|
// does not like it)
|
||||||
|
sigFpe::unset(false);
|
||||||
|
|
||||||
// Initialise render window
|
// Initialise render window
|
||||||
vtkSmartPointer<vtkRenderWindow> renderWindow =
|
vtkSmartPointer<vtkRenderWindow> renderWindow =
|
||||||
vtkSmartPointer<vtkRenderWindow>::New();
|
vtkSmartPointer<vtkRenderWindow>::New();
|
||||||
@ -204,6 +209,9 @@ void Foam::runTimePostProcessing::write()
|
|||||||
surfaces_[i].updateActors(position);
|
surfaces_[i].updateActors(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset any floating point trapping
|
||||||
|
sigFpe::set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user