Every Wii U application must go through a general lifecycle:
Your application must follow specific procedures to startup. For more information on starting up your application, see Starting Up.
When an application completes the startup procedure, it is running in the foreground.
The Wii U now has the capability of allowing the user to pause and hide an application.
If the user presses the HOME Button,
your application needs to move to the background.
This move is signaled by your application receiving a
RELEASE_FOREGROUND message from the system message queue. For more information,
see Multicore Processing
and the ProcUI Library.
In terms of foreground and background switching, your application has four states:
When your application is running in the foreground, its operation is normal and all resources are available. For more information on what your application can perform while running in the foreground, see Foreground State.
When the user presses the HOME Button, a
RELEASE_FOREGROUND message is sent to your application
and you are required to process this event message. This transition is facilitated by transition system messages. For more information about transition messages, see Transition Messages. For more information about the tasks you must perform
when your application receives a
see Request to Move to the Background. For more information on
what your application can perform while running in the background,
see Background State.
At some point, your background application may receive a
ACQUIRED_FOREGROUND message. You must process this message
and move back to the foreground. For more information about the tasks you must perform
when your application received an
see Request to Move to the Foreground.
For an overview of process switching, see Multicore Processing on the Wii U.
Your application must follow specific procedures to shut down. For more information about shutting down your application, see Shutting Down.
The following diagram shows the possible states that an application goes through in its lifecycle.
RELEASE_FOREGROUNDis retrieved from the system message queue
OSReleaseForegroundis called from all three cores
Consider two types of games:
Games that put all tasks that must run in background mode and their dependencies on Core 2 avoid the need for complex logic when switching between foreground and background modes.
If the game distributes FS and NET access among all 3 cores, a deadlock situation may occur when the game is in background mode for two reasons:
Games that distribute FS and NET operations among all three cores must carefully synchronize operations when switching to background mode without causing unnecessary delay to the foreground switch. Operations on Core 2 continue to run in background mode after the foreground switch and cannot perform further synchronization with cores 0 and 1 until the game returns to foreground mode.