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:
@@ -58,9 +58,6 @@ CApplication::~CApplication()
|
|||||||
|
|
||||||
if (FirstFunction)
|
if (FirstFunction)
|
||||||
{
|
{
|
||||||
// Show Start of termination
|
|
||||||
if (Log) Log->Message( dlLow, dlLow, "%s: Terminating...", ProcessName );
|
|
||||||
|
|
||||||
// Destroy functions
|
// Destroy functions
|
||||||
while (FirstFunction)
|
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;
|
TFunctionItem * FunctionItem;
|
||||||
|
|
||||||
// Check for FD Events/States
|
// Check for FD Events/States
|
||||||
@@ -364,7 +362,16 @@ bool CApplication::Run()
|
|||||||
|
|
||||||
// Process Functions
|
// Process Functions
|
||||||
for (FunctionItem = FirstFunction; FunctionItem; FunctionItem = FunctionItem->Next )
|
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;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
CFunctionCore * GetFunction( const char * Name );
|
CFunctionCore * GetFunction( const char * Name );
|
||||||
|
|
||||||
// Run Application
|
// Run Application
|
||||||
bool Run();
|
bool Run( bool TerminateOnError );
|
||||||
};
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user