The timer implementation is the most complicated part of the run-time libraries. Currently there are three files that are OS dependent:
The timer implementation is based on the task mechanism. Timer task waits for timer requests. Once a request was received, it becomes pending request, that within a given-time out will expire unless overwritten by a new request. The major point is that while the task waits for expiration of the request, it has to listen to new request. The assumption is that the asynchronous timer should handle only a single pending request, since the support for multiple requests is implemented in the generic level of the timer package.
The timer uses the underlying OS services that in general supply current time and system timer access. So these parts of the library should be replaced with and interface to the targeted OS services.
In addition, the timer supplies the means of synchronization. The synchronization services are not directly related to time. They are included because they can block/unblock the asynchronous timer calls. The major role of the synchronization services is to synchronize the main task with the environment and other tasks.
Note that the UNIX- oriented part of the timer uses the system signal SIGALARM in order to receive the timeout event. The Windows/VxWorks –oriented timer is built as a task that executes every time interval and evaluates timeout event itself.