Allow return status to be specified using quitWithStatus.

This commit is contained in:
Daniel Buckmaster 2014-09-21 18:27:31 +10:00
parent d08e594316
commit 9f47032522
13 changed files with 52 additions and 18 deletions

View file

@ -43,15 +43,21 @@ static Process* _theOneProcess = NULL; ///< the one instance of the Process clas
//-----------------------------------------------------------------------------
void Process::requestShutdown()
void Process::requestShutdown(S32 status)
{
Process::get()._RequestShutdown = true;
Process::get()._ReturnStatus = status;
}
S32 Process::getReturnStatus()
{
return Process::get()._ReturnStatus;
}
//-----------------------------------------------------------------------------
Process::Process()
: _RequestShutdown( false )
: _RequestShutdown( false ), _ReturnStatus( 0 )
{
}

View file

@ -64,7 +64,7 @@ public:
static bool processEvents();
/// Ask the processEvents() function to shutdown.
static void requestShutdown();
static void requestShutdown(S32 status = 0);
static void notifyInit(Delegate<bool()> del, F32 order = PROCESS_DEFAULT_ORDER)
@ -149,6 +149,9 @@ public:
/// Trigger the registered shutdown functions
static bool shutdown();
/// get the current return status code we've been asked to end with.
static S32 getReturnStatus();
private:
friend class StandardMainLoop;
@ -167,6 +170,7 @@ private:
Signal<bool()> _signalShutdown;
bool _RequestShutdown;
S32 _ReturnStatus;
};
/// Register a command line handling function.