Fix: Two one line fixes, xTaskCheckForTimeOut() and ulTaskGenericNotifyValueClear(). (#82)

ulTaskGenericNotifyValueClear() returned the notification value of the
currently running task, not the target task.  Now it returns the
notification value of the target task.

Some users expected xTaskCheckForTimeOut() to clear the 'last wake time'
value each time a timeout occurred, whereas it only did that in one path.
It now clears the last wake time in all paths that return that a timeout
occurred.
This commit is contained in:
RichardBarry 2020-08-09 16:18:57 -07:00 committed by GitHub
parent 287361091b
commit 55da9591c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3309,7 +3309,7 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut )
BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
TickType_t * const pxTicksToWait ) TickType_t * const pxTicksToWait )
{ {
BaseType_t xReturn; BaseType_t xReturn;
configASSERT( pxTimeOut ); configASSERT( pxTimeOut );
configASSERT( pxTicksToWait ); configASSERT( pxTicksToWait );
@ -3320,7 +3320,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
const TickType_t xConstTickCount = xTickCount; const TickType_t xConstTickCount = xTickCount;
const TickType_t xElapsedTime = xConstTickCount - pxTimeOut->xTimeOnEntering; const TickType_t xElapsedTime = xConstTickCount - pxTimeOut->xTimeOnEntering;
#if ( INCLUDE_xTaskAbortDelay == 1 ) #if( INCLUDE_xTaskAbortDelay == 1 )
if( pxCurrentTCB->ucDelayAborted != ( uint8_t ) pdFALSE ) if( pxCurrentTCB->ucDelayAborted != ( uint8_t ) pdFALSE )
{ {
/* The delay was aborted, which is not the same as a time out, /* The delay was aborted, which is not the same as a time out,
@ -3350,6 +3350,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
* around and gone past again. This passed since vTaskSetTimeout() * around and gone past again. This passed since vTaskSetTimeout()
* was called. */ * was called. */
xReturn = pdTRUE; xReturn = pdTRUE;
*pxTicksToWait = ( TickType_t ) 0;
} }
else if( xElapsedTime < *pxTicksToWait ) /*lint !e961 Explicit casting is only redundant with some compilers, whereas others require it to prevent integer conversion errors. */ else if( xElapsedTime < *pxTicksToWait ) /*lint !e961 Explicit casting is only redundant with some compilers, whereas others require it to prevent integer conversion errors. */
{ {
@ -3360,7 +3361,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
} }
else else
{ {
*pxTicksToWait = 0; *pxTicksToWait = ( TickType_t ) 0;
xReturn = pdTRUE; xReturn = pdTRUE;
} }
} }
@ -5245,7 +5246,7 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
/* Return the notification as it was before the bits were cleared, /* Return the notification as it was before the bits were cleared,
* then clear the bit mask. */ * then clear the bit mask. */
ulReturn = pxCurrentTCB->ulNotifiedValue[ uxIndexToClear ]; ulReturn = pxTCB->ulNotifiedValue[ uxIndexToClear ];
pxTCB->ulNotifiedValue[ uxIndexToClear ] &= ~ulBitsToClear; pxTCB->ulNotifiedValue[ uxIndexToClear ] &= ~ulBitsToClear;
} }
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();