Important Update:

- CApplicationCore:
  - Run() returns false if error on any Process() call
  - Add TerminateOnError param to Run() method,
    - if set, exit immediately if Process() on any process fails
    - if not set, exit after Process() on all processes
  - Remove "Terminating..." log
This commit is contained in:
Charl Wentzel
2017-07-17 07:18:52 +02:00
parent c90cb7b0f4
commit 9b86bf3573
2 changed files with 14 additions and 7 deletions

View File

@@ -58,9 +58,6 @@ CApplication::~CApplication()
if (FirstFunction)
{
// Show Start of termination
if (Log) Log->Message( dlLow, dlLow, "%s: Terminating...", ProcessName );
// Destroy functions
while (FirstFunction)
{
@@ -353,8 +350,9 @@ CFunctionCore * CApplication::GetFunction( const char * Name )
}
//---------------------------------------------------------------------------
bool CApplication::Run()
bool CApplication::Run( bool TerminateOnError )
{
bool AllGood = true;
TFunctionItem * FunctionItem;
// Check for FD Events/States
@@ -364,7 +362,16 @@ bool CApplication::Run()
// Process Functions
for (FunctionItem = FirstFunction; FunctionItem; FunctionItem = FunctionItem->Next )
FunctionItem->Function->Process();
return true;
{
if (!FunctionItem->Function->Process())
{
if (TerminateOnError)
return false;
else {
AllGood = false;
}
}
}
return AllGood;
}
//---------------------------------------------------------------------------

View File

@@ -92,7 +92,7 @@ public:
CFunctionCore * GetFunction( const char * Name );
// Run Application
bool Run();
bool Run( bool TerminateOnError );
};
//---------------------------------------------------------------------------