mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 00:57:44 -04:00
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:
parent
3bcdee89c6
commit
4aa6e04c6e
1 changed files with 2 additions and 0 deletions
2
tasks.c
2
tasks.c
|
@ -2636,7 +2636,9 @@ BaseType_t xYieldOccurred;
|
|||
/* Use xPendedTicks to mimic xTicksToCatchUp number of ticks occurring when
|
||||
the scheduler is suspended so the ticks are executed in xTaskResumeAll(). */
|
||||
vTaskSuspendAll();
|
||||
taskENTER_CRITICAL();
|
||||
xPendedTicks += xTicksToCatchUp;
|
||||
taskEXIT_CRITICAL();
|
||||
xYieldOccurred = xTaskResumeAll();
|
||||
|
||||
return xYieldOccurred;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue