Microsoft Windows CE 3.0  

CBaseReferenceClock Class

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This base class implements the IReferenceClockinterface.

The CBaseReferenceClockclass provides a full implementation of IReferenceClock. It uses CCritSeclocking support and CAMSchedulescheduler support.

Each advisecall defines a point in time when the caller wants to be notified. A periodic adviseis a regular series of such events. A list of these advise requests is maintained by the reference clock. The clock calculates the delay until the first requested advise, and signals an event at the due time.

Clients are not advised through callbacks. One-shot clients have an event set, while periodic clients have a semaphore released for each event notification. A semaphore allows a client to know exactly how many events were actually triggered, because multiple time periods might elapse before the client code executes.

During class construction, a worker thread is created. This thread executes a series of Microsoft Win32 WaitForSingleObjectcalls, waking up when a command is given to the thread or the next wake-up point is reached. The wake-up points are determined by clients making advise calls.

Protected Data Members

m_pSchedule Pointer to the CAMScheduleobject associated with this CBaseReferenceClock object.

Member Functions

CBaseReferenceClock Constructs a CBaseReferenceClockobject.
GetSchedule Returns the CAMSchedulepointer stored in the m_pScheduledata member.
SetTimeDelta Adjusts the values returned from CBaseReferenceClock::GetPrivateTimeby the amount specified in this member function.
TriggerThread Triggers the advise thread's event. If you override CBaseReferenceClock::GetPrivateTime, you should either reuse or abandon this method.

Implemented IReferenceClock Methods

AdvisePeriodic Requests an asynchronous periodic notification that a time has elapsed.
AdviseTime Requests an asynchronous notification that a time has elapsed.
GetTime Returns a reference time.
Unadvise Removes a previously established advise link.

Overridable Member Functions

GetPrivateTime Gets the current time from the real clock. Override this member function to implement your own clock.

Implemented INonDelegatingUnknown Methods

NonDelegatingQueryInterface Returns a pointer to interfaces supported, that is, IReferenceClock.