The Sleep Queue
The Sleep Queue
The Power Manager maintains an operating-system queue called the sleep
queue. The sleep queue contains pointers to all of the routines that the
Power Manager must call before it puts the Macintosh Portable into the
sleep state or returns it to the operating state. Each device driver, for
example, must place in the sleep queue a pointer to a routine that controls
power to the subsystem that the driver controls. When the Power Manager
is ready to put the Macintosh Portable into the sleep state, it calls each of the
routines listed in the sleep queue. Each routine performs whatever tasks are
necessary to prepare for the sleep state, including calling Power Manager
routines, and then returns control to the Power Manager. Similarly, the
Power Manager calls each routine in the sleep queue when it is returning
the Macintosh Portable to the operating state.
If you are writing a device driver or if you want your program to be informed
before the Macintosh Portable enters the sleep state, you must place an entry
for your routine in the sleep queue. If you do place an entry in the sleep queue,
remember to remove it before your device driver or application terminates.
You use the SleepQInstall and SleepQRemove procedures to install and
remove sleep queue entries, as described in
Placing a Routine in the Sleep Queue.
The Power Manager can call the routines listed in the sleep queue with
Sleep Requests, Sleep Demands, Wakeup Demands, or