CommTimer Class Reference

class CommTimer

Static utility class for global timer handling designed for use by Serial Server plug-ins (CSYs).

Public Member Functions
CDeltaTimer *GetTimer()
IMPORT_C voidQueue(TTimeIntervalMicroSeconds32, TDeltaTimerEntry &)
IMPORT_C voidRemove(TDeltaTimerEntry &)

Member Functions Documentation

GetTimer()

CDeltaTimer *GetTimer()[static]

Get the pointer to the global timer. If it does not exist, create a new timer and store the pointer in the TLS.

Only clients within CSYs should use this API, since this function has a legacy behaviour of panicking in the case of no memory. This is due to the API not containing a means to communicate this result back to the caller. In the case where GetTimer is used by a CSY this is not a problem since the CSY will be running in a thread that C32 has already allocated the CommTimer memory for.

Note:

This function is using TLS (Thread Local Storage) and may reduce performance.

Queue(TTimeIntervalMicroSeconds32, TDeltaTimerEntry &)

IMPORT_C voidQueue(TTimeIntervalMicroSeconds32aTimeInMicroSeconds,
TDeltaTimerEntry &aHandle
)[static]

Queue a timer on the global timer.

This class is only suitable for CSYs since it currently has no direct mechanism through which to release the Thread Local Storage and heap resources it allocates. In the case of CSYs these resources are managed separately by C32.

Note:

1. The Thread Local Storage of the calling thread must be available for use.

2. The first time this is called for a thread, a small amount of heap memory is required. If no memory is available, a "c32-fault" panic of type 7 is raised. Subsequent calls are not affected since they reuse this memory.

Parameters

TTimeIntervalMicroSeconds32 aTimeInMicroSecondsthe timeout value in micro seconds
TDeltaTimerEntry & aHandlehandle to the delta timer entry

Remove(TDeltaTimerEntry &)

IMPORT_C voidRemove(TDeltaTimerEntry &aHandle)[static]

Call cancel on the global timer

Note: This does not free the Thread Local Storage for the calling thread.

Parameters

TDeltaTimerEntry & aHandlethe timer to cancel