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"
68 runTimePtr_->stopAt(Time::stopAtControl::writeNow);
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_
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
sigStopAtWriteNow()
Construct null.
~sigStopAtWriteNow()
Destructor.
bool active() const
Is active?
static void set(const bool verbose)
(re)set signal catcher
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)