Implements a timeout mechanism via sigalarm. More...
#include <OSspecific/timer.H>
Implements a timeout mechanism via sigalarm.
timer myTimer(5); // 5 sec .. if (timedOut(myTimer)) { // timed out } else { // do something possible blocking }
Constructor set signal handler on sigalarm and alarm(). Destructor clears these.
timedOut is macro because setjmp can't be in member function of timer. ?something to do with stack frames.
Definition at line 82 of file timer.H.
Public Member Functions | |
ClassName ("timer") | |
Declare name of the class and its debug switch.
| |
timer (const unsigned int newTimeOut) | |
Construct from components.
| |
~timer () | |
Public Attributes | |
unsigned int | newTimeOut_ |
current time out value. Needed by macro timedOut
| |
Static Public Attributes | |
static jmp_buf | envAlarm |
state for setjmp. Needed by macro timedOut
|
timer | ( | const unsigned int | newTimeOut ) |
Construct from components.
newTimeOut=0 makes it do nothing.
Definition at line 60 of file timer.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, Foam::Info, and timer::newTimeOut_.
~timer | ( | ) |
Definition at line 110 of file timer.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, and Foam::Info.
ClassName | ( | "timer" | ) |
Declare name of the class and its debug switch.
unsigned int newTimeOut_ |
current time out value. Needed by macro timedOut
Definition at line 107 of file timer.H.
Referenced by timer::timer().
jmp_buf envAlarm [static]
|