35#define WIN32_LEAN_AND_MEAN
55unsigned int Foam::timer::oldTimeOut_ = 0;
62static VOID CALLBACK
timerExpired(PVOID lpParam, BOOLEAN TimerOrWaitFired)
70void Foam::timer::sigHandler(
int)
93 <<
"timer already used."
101 const bool ok = ::CreateTimerQueueTimer
116 <<
"CreateTimerQueueTimer, "
122 <<
"Installing timeout " << int(
timeOut_) <<
" seconds"
123 <<
" (overriding old timeout " << int(oldTimeOut_) <<
")." <<
endl;
137 <<
"timeOut=" << int(timeOut_)
138 <<
" : resetting timeOut to " << int(oldTimeOut_) <<
endl;
141 const bool ok = ::DeleteTimerQueueTimer(
nullptr,
hTimer_,
nullptr);
148 <<
"DeleteTimerQueueTimer, "
static VOID CALLBACK timerExpired(PVOID lpParam, BOOLEAN TimerOrWaitFired)
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.
std::string lastError()
The last Windows API error from GetLastError.
static void setHandler(const char *what, int sigNum, void(*handler)(int))
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
static void resetHandler(const char *what, int sigNum)
constexpr char nl
The newline '\n' character (0x0a)