PROBLEM: Exiting an app, or entire process. And the exiting could cause a catastrophic (unrecoverable) loss of data, or break in the session. Need to prevent this from happening.
SOLUTION: Present a modal dialogue which delays the user from exiting immediately (the app or function is kept open in the background), informs them of the consequences of exiting (loss of data) and requires them to make choices, at least confirm exit or return to session.
VARIATION: Timer inside exitguard, so you do need just one action to exit. Two actions will exit immediately, but one will exit after a few seconds. Timing depends on users and expected environment. Be sure to notify (sound and/or vibration) so users look at the screen!
OR: opposite. For very high criticality apps, have a limited time to hit the pop up and accept exiting. Else, returns to the running app. A version of this is the press-and-hold power (or a button) to turn off. This is not discoverable so a dialogue must appear immediately (and stay up after release of the button) to tell the user HOW to exit.