OMTimerManager provides timer services for all threads using a single timer task. The class is declared in the header file timer.h.
OMTimerManager manages timeout requests and issues timeout events to the system objects. OMTimerManager is a singleton active object. During framework initialization, the singleton is created and a single new thread is created for managing the timeout requests.
OMThreadTimer inherits from OMTimerManager and performs the actual timing services for the framework and your application. For more information on OMThreadTimer, see OMThreadTimer class.
OMTimerManager can implement two time models:
Simulated time is useful for debugging and algorithm validation.
The simulated time support is in run-time (a parameter is provided to the framework in the application initialization). However, in order to switch between real and simulated time, you need to regenerate and build the code.
In the current version, simulated time is handled at initialization time, via the isRealTime parameter in OXF::init.
The following methods are used with simulated time mode: init, the OMTimerManagerDefaults class, goNext (private), and goNextAndPost.
overflowMark
This protected attribute specifies the value used to determine whether the current system time (m_Time) has "overflowed." m_Time is implemented as an unsigned long integer; its maximum value is implementation-dependent.
It is defined as follows:
RP_FRAMEWORK_DLL static const timeUnit
overflowMark;
The timeUnit method is defined in rawtypes.h as follows:
typedef unsigned long timeUnit;
The value for overflowMark is specified in timer.cpp as follows:
const timeUnit OMTimerManager::overflowMark =
0x80000000;
The post method compares m_Time to overflowMark after it gets a pointer to the current timeout request in the heap. If m_Time >= overflowMark, the post method iterates over the heap to adjust the dueTime of each timeout request, and resets m_Time as follows:
m_Time &= ~overflowMark;
Updating dueTime and m_Time uses system resources. You should monitor m_Time carefully for your application.