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:
Charl Wentzel
2019-03-09 20:41:25 +02:00
parent 3626909786
commit 889df6c7de
6 changed files with 27 additions and 24 deletions

View File

@@ -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;
}
//---------------------------------------------------------------------------