STYLE: update noexcept and default construct for signals
- eliminate ClassName in favour of simple debug - include Apple-specific FPE handling after local definition to allow for more redefinitions COMP: remove stray <csignal> includes
This commit is contained in:
parent
b620152191
commit
97668eab26
@ -38,7 +38,6 @@ Description
|
|||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
|
|
||||||
#include <csignal>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuInfo_H
|
#ifndef Foam_cpuInfo_H
|
||||||
#define cpuInfo_H
|
#define Foam_cpuInfo_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuTime_H
|
#ifndef Foam_cpuTime_H
|
||||||
#define cpuTime_H
|
#define Foam_cpuTime_H
|
||||||
|
|
||||||
#include "cpuTimeCxx.H"
|
#include "cpuTimeCxx.H"
|
||||||
#include "cpuTimeFwd.H"
|
#include "cpuTimeFwd.H"
|
||||||
|
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuTimeFwd_H
|
#ifndef Foam_cpuTimeFwd_H
|
||||||
#define cpuTimeFwd_H
|
#define Foam_cpuTimeFwd_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fileMonitor.H"
|
#include "fileMonitor.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
#include "defineDebugSwitch.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
#include "PackedList.H"
|
#include "PackedList.H"
|
||||||
@ -64,12 +67,12 @@ Foam::fileMonitor::fileStateNames_
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fileMonitor, 0);
|
defineDebugSwitchWithName(fileMonitor, "fileMonitor", 0);
|
||||||
|
registerDebugSwitchWithName(fileMonitor, fileMonitor, "fileMonitor");
|
||||||
|
|
||||||
//- Reduction operator for PackedList of fileState
|
//- Reduction operator for PackedList of fileState
|
||||||
class reduceFileStates
|
struct reduceFileStates
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
unsigned int operator()(const unsigned int x, const unsigned int y)
|
unsigned int operator()(const unsigned int x, const unsigned int y)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
@ -98,9 +101,8 @@ namespace Foam
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Combine operator for PackedList of fileState
|
//- Combine operator for PackedList of fileState
|
||||||
class combineReduceFileStates
|
struct combineReduceFileStates
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
void operator()(unsigned int& x, const unsigned int y) const
|
void operator()(unsigned int& x, const unsigned int y) const
|
||||||
{
|
{
|
||||||
x = reduceFileStates()(x, y);
|
x = reduceFileStates()(x, y);
|
||||||
|
@ -42,11 +42,9 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fileMonitor_H
|
#ifndef Foam_fileMonitor_H
|
||||||
#define fileMonitor_H
|
#define Foam_fileMonitor_H
|
||||||
|
|
||||||
#include "Enum.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -59,6 +57,7 @@ namespace Foam
|
|||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class fileMonitor;
|
class fileMonitor;
|
||||||
class fileMonitorWatcher;
|
class fileMonitorWatcher;
|
||||||
|
template<class EnumType> class Enum;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fileMonitor Declaration
|
Class fileMonitor Declaration
|
||||||
@ -117,13 +116,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
//- Named/registered debug switch: 'fileMonitor'
|
||||||
ClassName("fileMonitor");
|
static int debug;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct with specified inotify use
|
||||||
fileMonitor(const bool useInotify);
|
explicit fileMonitor(const bool useInotify);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
@ -32,7 +32,7 @@ License
|
|||||||
#include "JobInfo.H"
|
#include "JobInfo.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "List.H"
|
#include "UList.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
|
|
||||||
#include <float.h> // For *fp functions
|
#include <float.h> // For *fp functions
|
||||||
|
@ -54,10 +54,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigFpe_H
|
#ifndef Foam_sigFpe_H
|
||||||
#define sigFpe_H
|
#define Foam_sigFpe_H
|
||||||
|
|
||||||
#include "scalar.H"
|
#include <cstddef> // for std::size_t
|
||||||
|
#include "scalarFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -118,16 +119,10 @@ public:
|
|||||||
static bool requested();
|
static bool requested();
|
||||||
|
|
||||||
//- True if SIGFPE handling is currently active.
|
//- True if SIGFPE handling is currently active.
|
||||||
static inline bool active()
|
static bool active() noexcept { return sigActive_; }
|
||||||
{
|
|
||||||
return sigActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- True if NaN memory initialisation is currently active.
|
//- True if NaN memory initialisation is currently active.
|
||||||
static inline bool nanActive()
|
static bool nanActive() noexcept { return nanActive_; }
|
||||||
{
|
|
||||||
return nanActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- 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
|
||||||
|
@ -45,8 +45,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigInt_H
|
#ifndef Foam_sigInt_H
|
||||||
#define sigInt_H
|
#define Foam_sigInt_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace Foam
|
|||||||
|
|
||||||
class sigInt
|
class sigInt
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Signal trapping enabled?
|
//- Signal trapping enabled?
|
||||||
static bool sigActive_;
|
static bool sigActive_;
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigInt();
|
sigInt();
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigQuit_H
|
#ifndef Foam_sigQuit_H
|
||||||
#define sigQuit_H
|
#define Foam_sigQuit_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigQuit();
|
sigQuit();
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigSegv_H
|
#ifndef Foam_sigSegv_H
|
||||||
#define sigSegv_H
|
#define Foam_sigSegv_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigSegv();
|
sigSegv();
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,10 +109,6 @@ void Foam::sigStopAtWriteNow::sigHandler(int)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow(const Time& runTime, bool verbose)
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow(const Time& runTime, bool verbose)
|
||||||
{
|
{
|
||||||
runTimePtr_ = &runTime; // Store runTime
|
runTimePtr_ = &runTime; // Store runTime
|
||||||
@ -135,18 +131,6 @@ Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::sigStopAtWriteNow::active()
|
|
||||||
{
|
|
||||||
return signal_ > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::sigStopAtWriteNow::signalNumber()
|
|
||||||
{
|
|
||||||
return signal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::sigStopAtWriteNow::set(bool verbose)
|
void Foam::sigStopAtWriteNow::set(bool verbose)
|
||||||
{
|
{
|
||||||
if (!active())
|
if (!active())
|
||||||
|
@ -34,10 +34,13 @@ Description
|
|||||||
SourceFiles
|
SourceFiles
|
||||||
sigStopAtWriteNow.C
|
sigStopAtWriteNow.C
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::JobInfo
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigStopAtWriteNow_H
|
#ifndef Foam_sigStopAtWriteNow_H
|
||||||
#define sigStopAtWriteNow_H
|
#define Foam_sigStopAtWriteNow_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,11 +76,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigStopAtWriteNow();
|
sigStopAtWriteNow();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct with Time reference
|
||||||
sigStopAtWriteNow(const Time& runTime, bool verbose=false);
|
explicit sigStopAtWriteNow(const Time& runTime, bool verbose=false);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -87,10 +90,10 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Is active?
|
//- Is active?
|
||||||
static bool active();
|
static bool active() noexcept { return (signal_ > 0); }
|
||||||
|
|
||||||
//- Signal number being used
|
//- Signal number being used
|
||||||
static int signalNumber();
|
static int signalNumber() noexcept { return signal_; }
|
||||||
|
|
||||||
//- Set/reset signal handler
|
//- Set/reset signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
@ -101,13 +101,9 @@ void Foam::sigWriteNow::sigHandler(int)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::sigWriteNow::sigWriteNow()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sigWriteNow::sigWriteNow(Time& runTime, bool verbose)
|
Foam::sigWriteNow::sigWriteNow(Time& runTime, bool verbose)
|
||||||
{
|
{
|
||||||
runTimePtr_ = &runTime; // Store runTime
|
runTimePtr_ = &runTime; // Store Time reference
|
||||||
set(verbose);
|
set(verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,18 +123,6 @@ Foam::sigWriteNow::~sigWriteNow()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::sigWriteNow::active()
|
|
||||||
{
|
|
||||||
return signal_ > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::sigWriteNow::signalNumber()
|
|
||||||
{
|
|
||||||
return signal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::sigWriteNow::set(bool verbose)
|
void Foam::sigWriteNow::set(bool verbose)
|
||||||
{
|
{
|
||||||
if (!active())
|
if (!active())
|
||||||
|
@ -36,8 +36,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigWriteNow_H
|
#ifndef Foam_sigWriteNow_H
|
||||||
#define sigWriteNow_H
|
#define Foam_sigWriteNow_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,11 +73,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigWriteNow();
|
sigWriteNow() noexcept = default;
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct with Time reference
|
||||||
sigWriteNow(Time& runTime, bool verbose=false);
|
explicit sigWriteNow(Time& runTime, bool verbose=false);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -87,14 +87,13 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Is active?
|
//- Is active?
|
||||||
static bool active();
|
static bool active() noexcept { return (signal_ > 0); }
|
||||||
|
|
||||||
//- The signal number being used
|
//- Signal number being used
|
||||||
static int signalNumber();
|
static int signalNumber() noexcept { return signal_; }
|
||||||
|
|
||||||
//- Set/reset signal handler
|
//- Set/reset signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2011 Symscape
|
Copyright (C) 2011 Symscape
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,7 @@ License
|
|||||||
|
|
||||||
#include "timer.H"
|
#include "timer.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
#include "defineDebugSwitch.H"
|
||||||
#include "MSwindows.H"
|
#include "MSwindows.H"
|
||||||
#undef DebugInfo // Windows name clash with OpenFOAM messageStream
|
#undef DebugInfo // Windows name clash with OpenFOAM messageStream
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ License
|
|||||||
// File-local functions
|
// File-local functions
|
||||||
#include "signalMacros.C"
|
#include "signalMacros.C"
|
||||||
|
|
||||||
|
#undef SIGALRM
|
||||||
#define SIGALRM 14
|
#define SIGALRM 14
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +49,8 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(timer, 0);
|
defineDebugSwitchWithName(timer, "timer", 0);
|
||||||
|
registerDebugSwitchWithName(timer, timer, "timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
jmp_buf Foam::timer::envAlarm;
|
jmp_buf Foam::timer::envAlarm;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,16 +61,16 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef timer_H
|
#ifndef Foam_timer_H
|
||||||
#define timer_H
|
#define Foam_timer_H
|
||||||
|
|
||||||
#include "className.H"
|
|
||||||
#include <csetjmp>
|
#include <csetjmp>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Check if timeout has occurred
|
//- Check if timeout has occurred
|
||||||
// keep setjmp in same stack frame so no function calls
|
// keep setjmp in same stack frame so no function calls
|
||||||
|
#undef timedOut
|
||||||
#define timedOut(x) \
|
#define timedOut(x) \
|
||||||
((x).timeOut_ ? setjmp(Foam::timer::envAlarm) : false)
|
((x).timeOut_ ? setjmp(Foam::timer::envAlarm) : false)
|
||||||
|
|
||||||
@ -99,8 +99,8 @@ public:
|
|||||||
|
|
||||||
// Public Data
|
// Public Data
|
||||||
|
|
||||||
//- Declare name of the class and its debug switch
|
//- Named/registered debug switch: 'timer'
|
||||||
ClassName("timer");
|
static int debug;
|
||||||
|
|
||||||
//- The time-out value (seconds). Needed by macro timedOut
|
//- The time-out value (seconds). Needed by macro timedOut
|
||||||
unsigned int timeOut_;
|
unsigned int timeOut_;
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with specified time-out, a value of 0 makes it a no-op.
|
//- Construct with specified time-out, a value of 0 makes it a no-op.
|
||||||
timer(unsigned int seconds);
|
explicit timer(unsigned int seconds);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor. Restores the alarm and signal handler as required.
|
//- Destructor. Restores the alarm and signal handler as required.
|
||||||
|
@ -40,8 +40,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuInfo_H
|
#ifndef Foam_cpuInfo_H
|
||||||
#define cpuInfo_H
|
#define Foam_cpuInfo_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -90,6 +90,7 @@ public:
|
|||||||
//- Construct and populate with information
|
//- Construct and populate with information
|
||||||
cpuInfo();
|
cpuInfo();
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~cpuInfo() = default;
|
~cpuInfo() = default;
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuTime_H
|
#ifndef Foam_cpuTime_H
|
||||||
#define cpuTime_H
|
#define Foam_cpuTime_H
|
||||||
|
|
||||||
#include "cpuTimePosix.H"
|
#include "cpuTimePosix.H"
|
||||||
#include "cpuTimeFwd.H"
|
#include "cpuTimeFwd.H"
|
||||||
|
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuTimeFwd_H
|
#ifndef Foam_cpuTimeFwd_H
|
||||||
#define cpuTimeFwd_H
|
#define Foam_cpuTimeFwd_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cpuTimePosix_H
|
#ifndef Foam_cpuTimePosix_H
|
||||||
#define cpuTimePosix_H
|
#define Foam_cpuTimePosix_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fileMonitor.H"
|
#include "fileMonitor.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
#include "defineDebugSwitch.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
#include "PackedList.H"
|
#include "PackedList.H"
|
||||||
@ -60,12 +63,12 @@ Foam::fileMonitor::fileStateNames_
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fileMonitor, 0);
|
defineDebugSwitchWithName(fileMonitor, "fileMonitor", 0);
|
||||||
|
registerDebugSwitchWithName(fileMonitor, fileMonitor, "fileMonitor");
|
||||||
|
|
||||||
//- Reduction operator for PackedList of fileState
|
//- Reduction operator for PackedList of fileState
|
||||||
class reduceFileStates
|
struct reduceFileStates
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
unsigned int operator()(const unsigned int x, const unsigned int y)
|
unsigned int operator()(const unsigned int x, const unsigned int y)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
@ -94,9 +97,8 @@ namespace Foam
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Combine operator for PackedList of fileState
|
//- Combine operator for PackedList of fileState
|
||||||
class combineReduceFileStates
|
struct combineReduceFileStates
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
void operator()(unsigned int& x, const unsigned int y) const
|
void operator()(unsigned int& x, const unsigned int y) const
|
||||||
{
|
{
|
||||||
x = reduceFileStates()(x, y);
|
x = reduceFileStates()(x, y);
|
||||||
|
@ -42,11 +42,9 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef fileMonitor_H
|
#ifndef Foam_fileMonitor_H
|
||||||
#define fileMonitor_H
|
#define Foam_fileMonitor_H
|
||||||
|
|
||||||
#include "Enum.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -59,6 +57,7 @@ namespace Foam
|
|||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class fileMonitor;
|
class fileMonitor;
|
||||||
class fileMonitorWatcher;
|
class fileMonitorWatcher;
|
||||||
|
template<class EnumType> class Enum;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fileMonitor Declaration
|
Class fileMonitor Declaration
|
||||||
@ -117,12 +116,13 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
//- Named/registered debug switch: 'fileMonitor'
|
||||||
ClassName("fileMonitor");
|
static int debug;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct with specified inotify use
|
||||||
explicit fileMonitor(const bool useInotify);
|
explicit fileMonitor(const bool useInotify);
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,12 +30,8 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::error::safePrintStack(std::ostream& os, int size)
|
void Foam::error::safePrintStack(std::ostream& os, int size) {}
|
||||||
{}
|
void Foam::error::printStack(Ostream& os, int size) {}
|
||||||
|
|
||||||
|
|
||||||
void Foam::error::printStack(Ostream& os, int size)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
@ -31,9 +31,12 @@ License
|
|||||||
#include "JobInfo.H"
|
#include "JobInfo.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "List.H"
|
#include "UList.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// File-local functions
|
||||||
|
#include "signalMacros.C"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#if defined(__linux__) && defined(__GNUC__)
|
#if defined(__linux__) && defined(__GNUC__)
|
||||||
@ -44,13 +47,11 @@ License
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Special handling for APPLE
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "feexceptErsatz.H"
|
#include "feexceptErsatz.H"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// File-local functions
|
|
||||||
#include "signalMacros.C"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -54,10 +54,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigFpe_H
|
#ifndef Foam_sigFpe_H
|
||||||
#define sigFpe_H
|
#define Foam_sigFpe_H
|
||||||
|
|
||||||
#include "scalar.H"
|
#include <cstddef> // for std::size_t
|
||||||
|
#include "scalarFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -118,16 +119,10 @@ public:
|
|||||||
static bool requested();
|
static bool requested();
|
||||||
|
|
||||||
//- True if SIGFPE handling is currently active.
|
//- True if SIGFPE handling is currently active.
|
||||||
static inline bool active()
|
static bool active() noexcept { return sigActive_; }
|
||||||
{
|
|
||||||
return sigActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- True if NaN memory initialisation is currently active.
|
//- True if NaN memory initialisation is currently active.
|
||||||
static inline bool nanActive()
|
static bool nanActive() noexcept { return nanActive_; }
|
||||||
{
|
|
||||||
return nanActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- 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
|
||||||
|
@ -45,8 +45,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigInt_H
|
#ifndef Foam_sigInt_H
|
||||||
#define sigInt_H
|
#define Foam_sigInt_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace Foam
|
|||||||
|
|
||||||
class sigInt
|
class sigInt
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Signal trapping enabled?
|
//- Signal trapping enabled?
|
||||||
static bool sigActive_;
|
static bool sigActive_;
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigInt();
|
sigInt();
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
~sigInt();
|
~sigInt();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Activate SIGINT signal handler
|
//- Activate SIGINT signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigQuit_H
|
#ifndef Foam_sigQuit_H
|
||||||
#define sigQuit_H
|
#define Foam_sigQuit_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigQuit();
|
sigQuit();
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigSegv_H
|
#ifndef Foam_sigSegv_H
|
||||||
#define sigSegv_H
|
#define Foam_sigSegv_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigSegv();
|
sigSegv();
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
~sigSegv();
|
~sigSegv();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
//- Activate SIGSEGV signal handler
|
//- Activate SIGSEGV signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
@ -111,10 +111,6 @@ void Foam::sigStopAtWriteNow::sigHandler(int)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow(const Time& runTime, bool verbose)
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow(const Time& runTime, bool verbose)
|
||||||
{
|
{
|
||||||
runTimePtr_ = &runTime; // Store runTime
|
runTimePtr_ = &runTime; // Store runTime
|
||||||
@ -137,18 +133,6 @@ Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::sigStopAtWriteNow::active()
|
|
||||||
{
|
|
||||||
return signal_ > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::sigStopAtWriteNow::signalNumber()
|
|
||||||
{
|
|
||||||
return signal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::sigStopAtWriteNow::set(bool verbose)
|
void Foam::sigStopAtWriteNow::set(bool verbose)
|
||||||
{
|
{
|
||||||
if (!active())
|
if (!active())
|
||||||
|
@ -34,10 +34,13 @@ Description
|
|||||||
SourceFiles
|
SourceFiles
|
||||||
sigStopAtWriteNow.C
|
sigStopAtWriteNow.C
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::JobInfo
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigStopAtWriteNow_H
|
#ifndef Foam_sigStopAtWriteNow_H
|
||||||
#define sigStopAtWriteNow_H
|
#define Foam_sigStopAtWriteNow_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,11 +76,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigStopAtWriteNow();
|
sigStopAtWriteNow() noexcept = default;
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct with Time reference
|
||||||
sigStopAtWriteNow(const Time& runTime, bool verbose=false);
|
explicit sigStopAtWriteNow(const Time& runTime, bool verbose=false);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -87,10 +90,10 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Is active?
|
//- Is active?
|
||||||
static bool active();
|
static bool active() noexcept { return (signal_ > 0); }
|
||||||
|
|
||||||
//- Signal number being used
|
//- Signal number being used
|
||||||
static int signalNumber();
|
static int signalNumber() noexcept { return signal_; }
|
||||||
|
|
||||||
//- Set/reset signal handler
|
//- Set/reset signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,9 +28,8 @@ License
|
|||||||
|
|
||||||
#include "sigWriteNow.H"
|
#include "sigWriteNow.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
#include "JobInfo.H"
|
|
||||||
#include "IOstreams.H"
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// File-local functions
|
// File-local functions
|
||||||
#include "signalMacros.C"
|
#include "signalMacros.C"
|
||||||
@ -103,13 +102,9 @@ void Foam::sigWriteNow::sigHandler(int)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::sigWriteNow::sigWriteNow()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sigWriteNow::sigWriteNow(Time& runTime, bool verbose)
|
Foam::sigWriteNow::sigWriteNow(Time& runTime, bool verbose)
|
||||||
{
|
{
|
||||||
runTimePtr_ = &runTime; // Store runTime
|
runTimePtr_ = &runTime; // Store Time reference
|
||||||
set(verbose);
|
set(verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,18 +124,6 @@ Foam::sigWriteNow::~sigWriteNow()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::sigWriteNow::active()
|
|
||||||
{
|
|
||||||
return signal_ > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::sigWriteNow::signalNumber()
|
|
||||||
{
|
|
||||||
return signal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::sigWriteNow::set(bool verbose)
|
void Foam::sigWriteNow::set(bool verbose)
|
||||||
{
|
{
|
||||||
if (!active())
|
if (!active())
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,8 +36,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef sigWriteNow_H
|
#ifndef Foam_sigWriteNow_H
|
||||||
#define sigWriteNow_H
|
#define Foam_sigWriteNow_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -73,11 +73,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
sigWriteNow();
|
sigWriteNow() noexcept = default;
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct with Time reference
|
||||||
sigWriteNow(Time& runTime, bool verbose=false);
|
explicit sigWriteNow(Time& runTime, bool verbose=false);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -87,14 +87,13 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Is active?
|
//- Is active?
|
||||||
static bool active();
|
static bool active() noexcept { return (signal_ > 0); }
|
||||||
|
|
||||||
//- The signal number being used
|
//- The signal number being used
|
||||||
static int signalNumber();
|
static int signalNumber() noexcept { return signal_; }
|
||||||
|
|
||||||
//- Set/reset signal handler
|
//- Set/reset signal handler
|
||||||
static void set(bool verbose=false);
|
static void set(bool verbose=false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,8 +26,9 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
|
||||||
#include "timer.H"
|
#include "timer.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "defineDebugSwitch.H"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -39,7 +40,8 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(timer, 0);
|
defineDebugSwitchWithName(timer, "timer", 0);
|
||||||
|
registerDebugSwitchWithName(timer, timer, "timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
jmp_buf Foam::timer::envAlarm;
|
jmp_buf Foam::timer::envAlarm;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,16 +61,16 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef timer_H
|
#ifndef Foam_timer_H
|
||||||
#define timer_H
|
#define Foam_timer_H
|
||||||
|
|
||||||
#include "className.H"
|
|
||||||
#include <csetjmp>
|
#include <csetjmp>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Check if timeout has occurred
|
//- Check if timeout has occurred
|
||||||
// keep setjmp in same stack frame so no function calls
|
// keep setjmp in same stack frame so no function calls
|
||||||
|
#undef timedOut
|
||||||
#define timedOut(x) \
|
#define timedOut(x) \
|
||||||
((x).timeOut_ ? setjmp(Foam::timer::envAlarm) : false)
|
((x).timeOut_ ? setjmp(Foam::timer::envAlarm) : false)
|
||||||
|
|
||||||
@ -99,8 +99,8 @@ public:
|
|||||||
|
|
||||||
// Public Data
|
// Public Data
|
||||||
|
|
||||||
//- Declare name of the class and its debug switch
|
//- Named/registered debug switch: 'timer'
|
||||||
ClassName("timer");
|
static int debug;
|
||||||
|
|
||||||
//- The time-out value (seconds). Needed by macro timedOut
|
//- The time-out value (seconds). Needed by macro timedOut
|
||||||
unsigned int timeOut_;
|
unsigned int timeOut_;
|
||||||
|
@ -34,11 +34,11 @@ License
|
|||||||
#include "UPstreamWrapping.H"
|
#include "UPstreamWrapping.H"
|
||||||
#include "collatedFileOperation.H"
|
#include "collatedFileOperation.H"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <csignal>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user