forked from espressif/esp-idf
freertos: Add some comments about deleting tasks when using SMP
Some cases are not immediately obvious, so document them in comments.
This commit is contained in:
@@ -1319,7 +1319,10 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
|
|||||||
uxTaskNumber++;
|
uxTaskNumber++;
|
||||||
|
|
||||||
if( pxTCB == curTCB ||
|
if( pxTCB == curTCB ||
|
||||||
|
/* in SMP, we also can't immediately delete the task active on the other core */
|
||||||
(portNUM_PROCESSORS > 1 && pxTCB == pxCurrentTCB[ !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)) )
|
(portNUM_PROCESSORS > 1 && pxTCB->xCoreID == (!core)) )
|
||||||
{
|
{
|
||||||
/* A task is deleting itself. This cannot complete within the
|
/* A task is deleting itself. This cannot complete within the
|
||||||
@@ -5690,7 +5693,7 @@ TickType_t xTimeToWake;
|
|||||||
const TickType_t xConstTickCount = xTickCount;
|
const TickType_t xConstTickCount = xTickCount;
|
||||||
|
|
||||||
if (portNUM_PROCESSORS > 1 && listIS_CONTAINED_WITHIN(&xTasksWaitingTermination, &( pxCurrentTCB[xCoreID]->xStateListItem))) {
|
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
|
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 */
|
be suspended permanently */
|
||||||
return;
|
return;
|
||||||
|
@@ -3,12 +3,11 @@
|
|||||||
* check if the task memory is freed immediately under the correct conditions.
|
* check if the task memory is freed immediately under the correct conditions.
|
||||||
*
|
*
|
||||||
* The behavior of vTaskDelete() results in the immediate freeing of task memory
|
* The behavior of vTaskDelete() results in the immediate freeing of task memory
|
||||||
* and the immediate execution of deletion callbacks under the following conditions...
|
* and the immediate execution of deletion callbacks for tasks which are not
|
||||||
* - When deleting a task that is not currently running on either core
|
* running, provided they are not pinned to the other core (due to FPU cleanup
|
||||||
* - When deleting a task that is pinned to the same core (with respect to
|
* requirements).
|
||||||
* the core that calls vTaskDelete()
|
|
||||||
*
|
*
|
||||||
* 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.
|
* deletion callbacks will still be carried out by the Idle Task.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Reference in New Issue
Block a user