Protect xPendedTicks with critical section

Function xTaskIncrementTick() increments xPendedTicks when the
scheduler is disabled.  That function typically executes inside the tick
ISR.  So code in xTaskCatchUpTicks() must mask interrupts when modifying
xPendedTicks.
This commit is contained in:
Jeff Tenney 2020-06-23 10:40:07 -07:00
parent 3bcdee89c6
commit 4aa6e04c6e

View file

@ -2636,7 +2636,9 @@ BaseType_t xYieldOccurred;
/* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when /* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when
the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */ the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */
vTaskSuspendAll(); vTaskSuspendAll();
taskENTER_CRITICAL();
xPendedTicks += xTicksToCatchUp; xPendedTicks += xTicksToCatchUp;
taskEXIT_CRITICAL();
xYieldOccurred = xTaskResumeAll(); xYieldOccurred = xTaskResumeAll();
return xYieldOccurred; return xYieldOccurred;