mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 17:17:44 -04:00
Send tmrCOMMAND_START_DONT_TRACE to front
When reloading an auto-reload timer, the timer task sends the tmrCOMMAND_START_DONT_TRACE command if the new timer period has already elapsed. If the command queue already contains a stop or delete command for the timer, then prior to this commit the tmrCOMMAND_START_DONT_TRACE command is processed *after* the stop or delete command. Consequently the timer is restarted unexpectedly (in the stop case) or uses freed memory (in the delete case). After this commit, the tmrCOMMAND_START_DONT_TRACE command is processed before the stop or delete command.
This commit is contained in:
parent
b08c19f745
commit
e2235a695e
1 changed files with 12 additions and 1 deletions
13
timers.c
13
timers.c
|
@ -395,7 +395,18 @@
|
|||
{
|
||||
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||
{
|
||||
xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait );
|
||||
/* The "start don't trace" command comes only from the timer
|
||||
* task itself. This command must be executed before any other
|
||||
* commands now in the queue for this timer, in case one of
|
||||
* those commands is stop or delete. */
|
||||
if( xCommandID == tmrCOMMAND_START_DONT_TRACE )
|
||||
{
|
||||
xReturn = xQueueSendToFront( xTimerQueue, &xMessage, xTicksToWait );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue