Handling sleep state transitions, Handling sleep state transitions -11 – Intel ARCHITECTURE IA-32 User Manual

Page 425

Advertising
background image

Power Optimization for Mobile Usages

9

9-11

disk operations over time. Use the GetDevicePowerState()
Windows API to test disk state and delay the disk access if it is not
spinning.

Handling Sleep State Transitions

In some cases, transitioning to a sleep state may harm an application.
For example, suppose an application is in the middle of using a file on
the network when the system enters suspend mode. Upon resuming, the
network connection may not be available and information could be lost.

An application may improve its behavior in such situations by becoming
aware of sleep state transitions. It can do this by using the
WM_POWERBROADCAST message. This message contains all the
necessary information for an application to react appropriately.

Here are some examples of an application reaction to sleep mode
transitions:

Saving state/data prior to the sleep transition and restoring state/data
after the wake up transition.

Closing all open system resource handles such as files and I/O
devices (this should include duplicated handles).

Disconnecting all communication links prior to the sleep transition
and re-establishing all communication links upon waking up.

Synchronizing all remote activity, such as like writing back to
remote files or to remote databases, upon waking up.

Stopping any ongoing user activity, such as streaming video, or a
file download, prior to the sleep transition and resuming the user
activity after the wake up transition.

Recommendation: Appropriately handling the suspend event enables
more robust, better performing applications.

Advertising