Important Update:
- DeviceCore:
- Added PollCycle variable (not used here)
- WatchdogCore:
- Return "true" on in Process()
- SelectableCore:
- Minor update (code compacted)
- Application/Function:
- Added CApplication as friend of CFunction
- Added param WaitToTerminate on Function
- Application Run() only exists if all (WaitToTerminate) functions
has terminated cleanly.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Global Vars
|
||||
extern bool Terminate;
|
||||
extern char * ProcessName;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -405,7 +406,8 @@ CFunctionCore * CApplication::GetFunction( const char * Name )
|
||||
|
||||
bool CApplication::Run( bool TerminateOnError )
|
||||
{
|
||||
bool AllGood = true;
|
||||
bool CleanTerminate = true;
|
||||
bool ProcessTerminate = false;
|
||||
TFunctionItem * FunctionItem;
|
||||
|
||||
// Check for FD Events/States
|
||||
@@ -416,15 +418,17 @@ bool CApplication::Run( bool TerminateOnError )
|
||||
// Process Functions
|
||||
for (FunctionItem = FirstFunction; FunctionItem; FunctionItem = FunctionItem->Next )
|
||||
{
|
||||
if (!FunctionItem->Function->Process())
|
||||
{
|
||||
if (TerminateOnError)
|
||||
return false;
|
||||
else {
|
||||
AllGood = false;
|
||||
}
|
||||
ProcessTerminate = !FunctionItem->Function->Process();
|
||||
if (TerminateOnError) {
|
||||
if (ProcessTerminate)
|
||||
Terminate = true;
|
||||
if (FunctionItem->Function->WaitToTerminate && !ProcessTerminate)
|
||||
CleanTerminate = false;
|
||||
}
|
||||
}
|
||||
return AllGood;
|
||||
if (Terminate && TerminateOnError && CleanTerminate)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user