freertos: Preempt other CPU when deleting a task running on it

Includes related fix to preemption unit tests (delete a queue after deleting the task blocked on it.)
This commit is contained in:
Angus Gratton 2017-05-10 17:23:33 +10:00 committed by Angus Gratton
parent ca4f5b9ee6
commit 895e7423a3
2 changed files with 6 additions and 1 deletions

View File

@ -1251,6 +1251,11 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
portPRE_TASK_DELETE_HOOK( pxTCB, &xYieldPending[xPortGetCoreID()] );
portYIELD_WITHIN_API();
}
else if ( portNUM_PROCESSORS > 1 && pxTCB == pxCurrentTCB[ !xPortGetCoreID() ] )
{
/* if task is running on the other CPU, force a yield on that CPU to take it off */
vPortYieldOtherCore( !xPortGetCoreID() );
}
else
{
/* Reset the next expected unblock time in case it referred to

View File

@ -66,8 +66,8 @@ TEST_CASE("Yield from lower priority task, same CPU", "[freertos]")
printf("Yielding from lower priority task took %u cycles\n", delta);
TEST_ASSERT(delta < 10000);
vQueueDelete(queue);
vTaskDelete(sender_task);
vQueueDelete(queue);
}
}