Skip to content

Commit

Permalink
Merge pull request #685 from jphickey/fix-684-cleanup-reorder
Browse files Browse the repository at this point in the history
Fix #684, order of CleanupTaskResources
  • Loading branch information
astrogeco authored May 19, 2020
2 parents 28faa4c + 8dad536 commit df31b09
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,24 +1114,12 @@ int32 CFE_ES_CleanUpApp(uint32 AppId)
*/
MainTaskId = CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskId;

/*
** Delete all of the OS resources, close files, and delete the main task
*/
Status = CFE_ES_CleanupTaskResources(MainTaskId);
if ( Status != CFE_SUCCESS )
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CleanUpApp: CleanUpTaskResources for Task ID:%d returned Error: 0x%08X\n",
(int)MainTaskId, (unsigned int)Status);
ReturnCode = CFE_ES_APP_CLEANUP_ERR;

}

/*
** Delete any child tasks associated with this app
*/
for ( i = 0; i < OS_MAX_TASKS; i++ )
{
/* delete only CHILD tasks - not the MainTaskId, which is already deleted (above) */
/* delete only CHILD tasks - not the MainTaskId, which will be deleted later (below) */
if ((CFE_ES_Global.TaskTable[i].RecordUsed == true) &&
(CFE_ES_Global.TaskTable[i].AppId == AppId) &&
(CFE_ES_Global.TaskTable[i].TaskId != MainTaskId))
Expand All @@ -1146,6 +1134,18 @@ int32 CFE_ES_CleanUpApp(uint32 AppId)
} /* end if */
} /* end for */

/*
** Delete all of the OS resources, close files, and delete the main task
*/
Status = CFE_ES_CleanupTaskResources(MainTaskId);
if ( Status != CFE_SUCCESS )
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CleanUpApp: CleanUpTaskResources for Task ID:%d returned Error: 0x%08X\n",
(int)MainTaskId, (unsigned int)Status);
ReturnCode = CFE_ES_APP_CLEANUP_ERR;

}

/*
** Remove the app from the AppTable
*/
Expand Down

0 comments on commit df31b09

Please sign in to comment.