mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Split traceTASK_NOTIFY_WAIT into _EXT and _FAILED hooks.
The old traceTASK_NOTIFY_WAIT hook was always called (no matter the success or failure of the action) and did not hygienically expose enough information for the tracer to determine the state of the task notification after it has been taken. The new traceTASK_NOTIFY_WAIT_EXT hook is called only if the notification was taken successfully and hygienically expose ulBitsToClearOnExit. The new traceTASK_NOTIFY_WAIT_FAILED hook is called if the notification could not be taken. This matches how the tracing hooks for all other APIs that attempt to receive/take a resource and my block function: First, if the task blocks, a BLOCK or BLOCKING trace hook is called. Then, either a normal or FAILED trace hook is called, indicating if the operation timed out or succeeded. Both hooks fall back on the old traceTASK_NOTIFY_WAIT, preserving its functionality for backwards compatibility. Not that there is a very slight breaking change in this commit: traceTASK_NOTIFY_WAIT is now called after the out-var pulNotificationValue is set. Because this pointer was in an unknown/user-set state when the tracing hook was previously called, it is highly unlikely that there are any tracers that rely on this.
This commit is contained in:
parent
ab558f5f97
commit
8c87469263
|
@ -1017,6 +1017,25 @@
|
||||||
#define traceTASK_NOTIFY_WAIT( uxIndexToWait )
|
#define traceTASK_NOTIFY_WAIT( uxIndexToWait )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_NOTIFY_WAIT_EXT
|
||||||
|
|
||||||
|
/* Extended version of traceTASK_NOTIFY_WAIT that also exposes value of
|
||||||
|
* ulBitsToClearOnExit, informing the tracer of the state of this task
|
||||||
|
* notification after it has been taken. Note that this hook, unlike
|
||||||
|
* traceTASK_NOTIFY_WAIT, is only called if the notification was successfully
|
||||||
|
* taken. */
|
||||||
|
#define traceTASK_NOTIFY_WAIT_EXT( uxIndexToWait, ulBitsToClearOnExit ) traceTASK_NOTIFY_WAIT( uxIndexToWait )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_NOTIFY_WAIT_FAILED
|
||||||
|
|
||||||
|
/* Task notification wait failed. For backwards-compatability, this macro falls
|
||||||
|
* back on traceTASK_NOTIFY_WAIT which was always called, no matter if
|
||||||
|
* successfull or not. */
|
||||||
|
#define traceTASK_NOTIFY_WAIT_FAILED( uxIndexToWait ) traceTASK_NOTIFY_WAIT( uxIndexToWait )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef traceTASK_NOTIFY
|
#ifndef traceTASK_NOTIFY
|
||||||
#define traceTASK_NOTIFY( uxIndexToNotify )
|
#define traceTASK_NOTIFY( uxIndexToNotify )
|
||||||
#endif
|
#endif
|
||||||
|
|
6
tasks.c
6
tasks.c
|
@ -7741,6 +7741,8 @@ TickType_t uxTaskResetEventItemValue( void )
|
||||||
/* Only block if a notification is not already pending. */
|
/* Only block if a notification is not already pending. */
|
||||||
if( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED )
|
if( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED )
|
||||||
{
|
{
|
||||||
|
traceTASK_NOTIFY_VALUE_CLEAR( pxCurrentTCB, uxIndexToWaitOn, ulBitsToClearOnEntry );
|
||||||
|
|
||||||
/* Clear bits in the task's notification value as bits may get
|
/* Clear bits in the task's notification value as bits may get
|
||||||
* set by the notifying task or interrupt. This can be used
|
* set by the notifying task or interrupt. This can be used
|
||||||
* to clear the value to zero. */
|
* to clear the value to zero. */
|
||||||
|
@ -7792,8 +7794,6 @@ TickType_t uxTaskResetEventItemValue( void )
|
||||||
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
traceTASK_NOTIFY_WAIT( uxIndexToWaitOn );
|
|
||||||
|
|
||||||
if( pulNotificationValue != NULL )
|
if( pulNotificationValue != NULL )
|
||||||
{
|
{
|
||||||
/* Output the current notification value, which may or may not
|
/* Output the current notification value, which may or may not
|
||||||
|
@ -7808,12 +7808,14 @@ TickType_t uxTaskResetEventItemValue( void )
|
||||||
if( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED )
|
if( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED )
|
||||||
{
|
{
|
||||||
/* A notification was not received. */
|
/* A notification was not received. */
|
||||||
|
traceTASK_NOTIFY_WAIT_FAILED( uxIndexToWaitOn );
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* A notification was already pending or a notification was
|
/* A notification was already pending or a notification was
|
||||||
* received while the task was waiting. */
|
* received while the task was waiting. */
|
||||||
|
traceTASK_NOTIFY_WAIT_EXT( uxIndexToWaitOn, ulBitsToClearOnExit );
|
||||||
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] &= ~ulBitsToClearOnExit;
|
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] &= ~ulBitsToClearOnExit;
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue