freertos: Add some comments about deleting tasks when using SMP

Some cases are not immediately obvious, so document them in comments.
pull/7183/head
Angus Gratton 2020-12-24 09:44:03 +11:00
rodzic c725aa3ec1
commit a7994b1a42
2 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -1319,7 +1319,10 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
uxTaskNumber++;
if( pxTCB == curTCB ||
/* in SMP, we also can't immediately delete the task active on the other core */
(portNUM_PROCESSORS > 1 && pxTCB == pxCurrentTCB[ !core ]) ||
/* ... and we can't delete a non-running task pinned to the other core, as
FPU cleanup has to happen on the same core */
(portNUM_PROCESSORS > 1 && pxTCB->xCoreID == (!core)) )
{
/* A task is deleting itself. This cannot complete within the
@ -5690,7 +5693,7 @@ TickType_t xTimeToWake;
const TickType_t xConstTickCount = xTickCount;
if (portNUM_PROCESSORS > 1 && listIS_CONTAINED_WITHIN(&xTasksWaitingTermination, &( pxCurrentTCB[xCoreID]->xStateListItem))) {
/* vTaskDelete() has been called on this task. This would have happened from the other core while this task was spinning on xTaskQueueMutex,
/* vTaskDelete() has been called to delete this task. This would have happened from the other core while this task was spinning on xTaskQueueMutex,
so don't move the running task to the delayed list - as soon as this core re-enables interrupts this task will
be suspended permanently */
return;

Wyświetl plik

@ -3,12 +3,11 @@
* check if the task memory is freed immediately under the correct conditions.
*
* The behavior of vTaskDelete() results in the immediate freeing of task memory
* and the immediate execution of deletion callbacks under the following conditions...
* - When deleting a task that is not currently running on either core
* - When deleting a task that is pinned to the same core (with respect to
* the core that calls vTaskDelete()
* and the immediate execution of deletion callbacks for tasks which are not
* running, provided they are not pinned to the other core (due to FPU cleanup
* requirements).
*
* If the two conditions are not met, freeing of task memory and execution of
* If the condition is not met, freeing of task memory and execution of
* deletion callbacks will still be carried out by the Idle Task.
*/
#include <stdio.h>