Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #684, order of CleanupTaskResources #685

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1280,24 +1280,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 @@ -1312,6 +1300,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