Don't suspend scheduler if task already notified

This commit is contained in:
Jeff Tenney 2024-11-11 15:27:11 -07:00
parent d0d55f3031
commit d0686d5f2b

33
tasks.c
View file

@ -7653,12 +7653,17 @@ TickType_t uxTaskResetEventItemValue( void )
TickType_t xTicksToWait )
{
uint32_t ulReturn;
BaseType_t xAlreadyYielded, xShouldBlock = pdFALSE;
traceENTER_ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait );
configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES );
/* If the notification count is zero, and if we are willing to wait for a
* notification, then block the task and wait. */
if( ( pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] == 0U ) && ( xTicksToWait > ( TickType_t ) 0 ) )
{
BaseType_t xAlreadyYielded, xShouldBlock = pdFALSE;
/* We suspend the scheduler here as prvAddCurrentTaskToDelayedList is a
* non-deterministic operation. */
vTaskSuspendAll();
@ -7675,8 +7680,7 @@ TickType_t uxTaskResetEventItemValue( void )
/* Mark this task as waiting for a notification. */
pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] = taskWAITING_NOTIFICATION;
if( xTicksToWait > ( TickType_t ) 0 )
{
/* Arrange to wait for a notification. */
xShouldBlock = pdTRUE;
}
else
@ -7684,11 +7688,6 @@ TickType_t uxTaskResetEventItemValue( void )
mtCOVERAGE_TEST_MARKER();
}
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
taskEXIT_CRITICAL();
/* We are now out of the critical section but the scheduler is still
@ -7715,6 +7714,7 @@ TickType_t uxTaskResetEventItemValue( void )
{
mtCOVERAGE_TEST_MARKER();
}
}
taskENTER_CRITICAL();
{
@ -7757,12 +7757,18 @@ TickType_t uxTaskResetEventItemValue( void )
uint32_t * pulNotificationValue,
TickType_t xTicksToWait )
{
BaseType_t xReturn, xAlreadyYielded, xShouldBlock = pdFALSE;
BaseType_t xReturn;
traceENTER_xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES );
/* If the task hasn't received a notification, and if we are willing to wait
* for it, then block the task and wait. */
if( ( pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] != taskNOTIFICATION_RECEIVED ) && ( xTicksToWait > ( TickType_t ) 0 ) )
{
BaseType_t xAlreadyYielded, xShouldBlock = pdFALSE;
/* We suspend the scheduler here as prvAddCurrentTaskToDelayedList is a
* non-deterministic operation. */
vTaskSuspendAll();
@ -7783,8 +7789,7 @@ TickType_t uxTaskResetEventItemValue( void )
/* Mark this task as waiting for a notification. */
pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] = taskWAITING_NOTIFICATION;
if( xTicksToWait > ( TickType_t ) 0 )
{
/* Arrange to wait for a notification. */
xShouldBlock = pdTRUE;
}
else
@ -7792,11 +7797,6 @@ TickType_t uxTaskResetEventItemValue( void )
mtCOVERAGE_TEST_MARKER();
}
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
taskEXIT_CRITICAL();
/* We are now out of the critical section but the scheduler is still
@ -7823,6 +7823,7 @@ TickType_t uxTaskResetEventItemValue( void )
{
mtCOVERAGE_TEST_MARKER();
}
}
taskENTER_CRITICAL();
{