47unsigned int Foam::timer::oldTimeOut_ = 0;
52void Foam::timer::sigHandler(
int)
75 <<
"timer already used."
83 setHandler(
"SIGALRM",
SIGALRM, sigHandler);
86 oldTimeOut_ = ::alarm(timeOut_);
89 <<
"Installing timeout " << int(timeOut_) <<
" seconds"
90 <<
" (overriding old timeout " << int(oldTimeOut_) <<
")." <<
endl;
105 <<
" : resetting timeOut to " << int(oldTimeOut_) <<
endl;
108 ::alarm(oldTimeOut_);
File-local code for setting/resetting signal handlers.
Implements a timeout mechanism via sigalarm.
~timer()
Destructor. Restores the alarm and signal handler as required.
static jmp_buf envAlarm
State for setjmp. Needed by macro timedOut.
unsigned int timeOut_
The time-out value (seconds). Needed by macro timedOut.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInFunction
Report an information message using Foam::Info.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
static void resetHandler(const char *what, int sigNum)