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_)
113 <<
" : resetting timeOut to " << int(oldTimeOut_) <<
endl;
117 ::alarm(oldTimeOut_);
121 if (sigaction(SIGALRM, &oldAction_,
nullptr) < 0)
124 <<
"sigaction(SIGALRM) error" timer(const unsigned int newTimeOut)
Construct from components.
unsigned int newTimeOut_
Current time out value. Needed by macro timedOut.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)
#define InfoInFunction
Report an information message using Foam::Info.
static jmp_buf envAlarm
State for setjmp. Needed by macro timedOut.