The procedures for logging out, restarting the
system, and shutting down the system have semantics similar to
those for logging in. The foreground process usually initiates
these procedures in response to the user choosing an item from the Apple menu; however, a process can
also initiate the procedure programmatically by sending an
appropriate Apple event to the loginwindow process. The loginwindow
process carries out the procedure, posting alerts and notifying
applications to give them a chance to clean up before closing.
1.
|
The user chooses Log Out, Restart, or Shut
Down from the Apple menu.
|
2.
|
The foreground application initiates the user
request by sending an Apple event to the loginwindow process.
|
3.
|
The loginwindow process displays an alert to
the user asking for confirmation of the action.
|
4.
|
If the user confirms the action, loginwindow
sends a Quit Application event (kAEQuitApplication) to every
foreground and background user process.
NOTE
An unresponsive application can prevent a user
from logging out or shutting down the computer. After 45 seconds,
loginwindow automatically aborts the termination sequence. In this
case, force quit the application and try logging out or shutting
down again.
|
5.
|
The loginwindow process closes out the user
session and continues with one of the following actions:
-
On a logout action, loginwindow dequeues all
events in the event queue, starts the logout-hook program (if one
is defined), records the logout, resets device permissions and user
preferences to their defaults, and returns the user to the login
window.
-
On a restart, loginwindow sets the device
permissions and user preferences to their defaults, powers off the
system, and then powers it back on to start the startup
process.
-
On a shutdown, loginwindow powers off the
computer.
|