Implements a timeout mechanism via sigalarm. More...
Public Member Functions | |
ClassName ("timer") | |
Declare name of the class and its debug switch. More... | |
timer (const unsigned int newTimeOut) | |
Construct from components. More... | |
~timer () | |
Destructor. More... | |
Data Fields | |
unsigned int | newTimeOut_ |
Current time out value. Needed by macro timedOut. More... | |
Static Public Attributes | |
static jmp_buf | envAlarm |
State for setjmp. Needed by macro timedOut. More... | |
Static Private Member Functions | |
static void | signalHandler (int) |
Alarm handler. More... | |
Static Private Attributes | |
static struct sigaction | oldAction_ |
Old signal masks. More... | |
static unsigned int | oldTimeOut_ = 0 |
Old alarm() value. More... | |
Implements a timeout mechanism via sigalarm.
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.
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, FatalErrorInFunction, Foam::Info, timer::newTimeOut_, timer::oldAction_, timer::oldTimeOut_, and timer::signalHandler().
~timer | ( | ) |
Destructor.
Definition at line 106 of file timer.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and Foam::Info.
|
staticprivate |
Alarm handler.
Definition at line 47 of file timer.C.
References Foam::endl(), and Foam::Info.
Referenced by timer::timer().
ClassName | ( | "timer" | ) |
Declare name of the class and its debug switch.
|
staticprivate |
|
staticprivate |
unsigned int newTimeOut_ |
Current time out value. Needed by macro timedOut.
Definition at line 106 of file timer.H.
Referenced by timer::timer().
|
static |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.