mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Move the call that sets xTimeNow inside the loop that drains the timer queue to ensure higher priority tasks that pre-empt the timer daemon cannot post messages that appear to be in the future to the daemon task.
This commit is contained in:
parent
0d421482d8
commit
2e24f1b789
|
@ -512,10 +512,6 @@ xTIMER *pxTimer;
|
||||||
portBASE_TYPE xTimerListsWereSwitched, xResult;
|
portBASE_TYPE xTimerListsWereSwitched, xResult;
|
||||||
portTickType xTimeNow;
|
portTickType xTimeNow;
|
||||||
|
|
||||||
/* In this case the xTimerListsWereSwitched parameter is not used, but it
|
|
||||||
must be present in the function call. */
|
|
||||||
xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );
|
|
||||||
|
|
||||||
while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )
|
while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )
|
||||||
{
|
{
|
||||||
pxTimer = xMessage.pxTimer;
|
pxTimer = xMessage.pxTimer;
|
||||||
|
@ -528,6 +524,14 @@ portTickType xTimeNow;
|
||||||
|
|
||||||
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );
|
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );
|
||||||
|
|
||||||
|
/* In this case the xTimerListsWereSwitched parameter is not used, but
|
||||||
|
it must be present in the function call. prvSampleTimeNow() must be
|
||||||
|
called after the message is received from xTimerQueue so there is no
|
||||||
|
possibility of a higher priority task adding a message to the message
|
||||||
|
queue with a time that is ahead of the timer daemon task (because it
|
||||||
|
pre-empted the timer daemon task after the xTimeNow value was set). */
|
||||||
|
xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );
|
||||||
|
|
||||||
switch( xMessage.xMessageID )
|
switch( xMessage.xMessageID )
|
||||||
{
|
{
|
||||||
case tmrCOMMAND_START :
|
case tmrCOMMAND_START :
|
||||||
|
@ -680,3 +684,6 @@ xTIMER *pxTimer = ( xTIMER * ) xTimer;
|
||||||
to include software timer functionality. If you want to include software timer
|
to include software timer functionality. If you want to include software timer
|
||||||
functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */
|
functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */
|
||||||
#endif /* configUSE_TIMERS == 1 */
|
#endif /* configUSE_TIMERS == 1 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue