39 struct sigaction
timer::oldAction_;
41 unsigned int timer::oldTimeOut_ = 0;
47 void Foam::timer::signalHandler(int)
61 newTimeOut_(newTimeOut)
70 <<
"timer already used."
77 struct sigaction newAction;
78 newAction.sa_handler = timer::signalHandler;
79 newAction.sa_flags = SA_NODEFER;
80 sigemptyset(&newAction.sa_mask);
82 if (sigaction(SIGALRM, &newAction, &oldAction_) < 0)
85 <<
"sigaction(SIGALRM) error"
89 oldTimeOut_ = ::alarm(newTimeOut);
96 <<
" (overriding old timeout " << int(oldTimeOut_)
112 <<
"timeOut=" << int(newTimeOut_)
113 <<
" : resetting timeOut to " << int(oldTimeOut_) <<
endl;
117 ::alarm(oldTimeOut_);
121 if (sigaction(SIGALRM, &oldAction_,
nullptr) < 0)
124 <<
"sigaction(SIGALRM) error"
Implements a timeout mechanism via sigalarm.
unsigned int newTimeOut_
Current time out value. Needed by macro timedOut.
static jmp_buf envAlarm
State for setjmp. Needed by macro timedOut.
timer(const unsigned int newTimeOut)
Construct from components.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define InfoInFunction
Report an information message using Foam::Info.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)