CeSetPowerOnEvent() is an interesting and powerful function when used with Windows CE 4.1 and 4.2, but after that its behavior changes. CeSetPowerOnEvent() was created to allow drivers to set events in their XXX_PowerUp() and XXX_PowerDown() functions. The power functions must not call functions that block or could cause a context switch, which included SetEvent(), so CeSetPowerOnEvent() was created to queue up the events temporarily to be signaled later.
Behavior of CeSetPowerOnEvent() in Windows CE 4.1 and 4.2
  • On calling CeSetPowerOnEvent() the event is added to a linked list of events to be signaled during resume. The events are not signaled at this time.
  • On resume, but after drivers (device manager and GWES) power functions are called and the power manager is restarted, the events in the linked list are signaled.
So this means that calling CeSetPowerOnEvent() will only cause the event to be signaled after drivers have resumed. The event will not be signaled at any other time because of a call to CeSetPowerOnEvent().  Once CeSetPowerOnEvent() is called, the event is queued and will be signaled on resume.
Behavior of CeSetPowerOnEvent() in Windows CE 5.0 and later
CeSetPowerOnEvent() is implemented as a wrapper for SetEvent().
Copyright © 2009 – Bruce Eitman
All Rights Reserved