AppUi::Exit() vs User::Exit()
User::Exit()
- User::Exit() terminates the current thread or current process ( If the current thread is the main thread in a process), cleaning up any resources used.
- User::Exit() does not call the destructors, it forcefully cleans the resources.
- This function cannot leave.
AppUi::Exit()
- It closes the app UI , it stops the CONE environment, the active scheduler, and calls other functions, such as CCoeEnv::PrepareToExit() before destroying the environment.
- AppUi::Exit() initiates systematic cleanup of the resources by calling destructor's and appropriate framework routines, hence it can leave even if it does not contain trailing "L".
This page was last modified on 3 February 2012, at 07:09.
119 page views in the last 30 days.
30 Sep
2009
This article explains very well the difference between using AppUi::Exit() and User::Exit(). Usually it is advised to exit any application using AppUi::Exit() instead of User::Exit(). The explanation on why this is essential has been highlighted very well in this article.
FYI: AppUi::Exit() DOES leave even in normal conditions, with the special leave code KLeaveExit (-1003). This way it breaks the execution of the function from where it was called, and the Active Scheduler of the current thread catches this code and stops the scheduler. --mrtj 13:28, 18 January 2011 (UTC)