38 int sigStopAtWriteNow::signal_
46 Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ =
nullptr;
47 struct sigaction
Foam::sigStopAtWriteNow::oldAction_;
52 void Foam::sigStopAtWriteNow::sigHandler(int)
55 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
58 <<
"Cannot reset " << signal_ <<
" trapping" 65 Info<<
"sigStopAtWriteNow :" 66 <<
" setting up write and stop at end of the next iteration" 87 runTimePtr_ = &runTime;
100 if (sigaction(signal_, &oldAction_,
nullptr) < 0)
103 <<
"Cannot reset " << signal_ <<
" trapping" 117 if (sigWriteNow::signal_ == signal_)
120 <<
"stopAtWriteNowSignal : " << signal_
121 <<
" cannot be the same as the writeNowSignal." 122 <<
" Please change this in the etc/controlDict." 127 struct sigaction newAction;
128 newAction.sa_handler = sigHandler;
129 newAction.sa_flags = SA_NODEFER;
130 sigemptyset(&newAction.sa_mask);
131 if (sigaction(signal_, &newAction, &oldAction_) < 0)
134 <<
"Cannot set " << signal_ <<
" trapping" 140 Info<<
"sigStopAtWriteNow :" 141 <<
" Enabling writing and stopping upon signal " << signal_
~sigStopAtWriteNow()
Destructor.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
set endTime to stop immediately w/ writing
Ostream & endl(Ostream &os)
Add newline and flush stream.
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
bool active() const
Is active?
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static void set(const bool verbose)
(re)set signal catcher
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
errorManip< error > abort(error &err)
sigStopAtWriteNow()
Construct null.