Merge branch 'bugfix/uxTaskGetSystemState_github_#12142' into 'master'

Bugfix for uxTaskGetSystemState

See merge request !883
This commit is contained in:
Ivan Grokhotkov
2017-06-20 17:27:08 +08:00
2 changed files with 69 additions and 3 deletions

View File

@@ -2280,7 +2280,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void )
UBaseType_t uxTask = 0, uxQueue = configMAX_PRIORITIES;
UNTESTED_FUNCTION();
vTaskSuspendAll(); //WARNING: This only suspends one CPU. ToDo: suspend others as well. Mux using taskQueueMutex maybe?
taskENTER_CRITICAL(&xTaskQueueMutex);
{
/* Is there a space in the array for each task in the system? */
if( uxArraySize >= uxCurrentNumberOfTasks )
@@ -2340,8 +2340,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void )
mtCOVERAGE_TEST_MARKER();
}
}
( void ) xTaskResumeAll();
taskEXIT_CRITICAL(&xTaskQueueMutex);
return uxTask;
}