mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Indent contents of a taskENTER_CRITICAL/taskEXIT_CRITICAL block. (#348)
* Indent contents of a taskENTER_CRITICAL/taskEXIT_CRITICAL block. Move a few configASSERT() statements out of a path where they would always be triggered to prevent "condition is always true" compiler warnings. * Replace configASSERT() positions due to unintended semantic change from the version where asserts were at the top of the file. Co-authored-by: RichardBarry <richardbarry.c@gmail.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
ce81bcb33f
commit
b97bb48e06
50
queue.c
50
queue.c
|
@ -277,26 +277,31 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
( ( SIZE_MAX / pxQueue->uxLength ) >= pxQueue->uxItemSize ) )
|
( ( SIZE_MAX / pxQueue->uxLength ) >= pxQueue->uxItemSize ) )
|
||||||
{
|
{
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
|
|
||||||
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
|
|
||||||
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
|
|
||||||
pxQueue->pcWriteTo = pxQueue->pcHead;
|
|
||||||
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - 1U ) * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
|
|
||||||
pxQueue->cRxLock = queueUNLOCKED;
|
|
||||||
pxQueue->cTxLock = queueUNLOCKED;
|
|
||||||
|
|
||||||
if( xNewQueue == pdFALSE )
|
|
||||||
{
|
{
|
||||||
/* If there are tasks blocked waiting to read from the queue, then
|
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
|
||||||
* the tasks will remain blocked as after this function exits the queue
|
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
|
||||||
* will still be empty. If there are tasks blocked waiting to write to
|
pxQueue->pcWriteTo = pxQueue->pcHead;
|
||||||
* the queue, then one should be unblocked as after this function exits
|
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - 1U ) * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
|
||||||
* it will be possible to write to it. */
|
pxQueue->cRxLock = queueUNLOCKED;
|
||||||
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
|
pxQueue->cTxLock = queueUNLOCKED;
|
||||||
|
|
||||||
|
if( xNewQueue == pdFALSE )
|
||||||
{
|
{
|
||||||
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
|
/* If there are tasks blocked waiting to read from the queue, then
|
||||||
|
* the tasks will remain blocked as after this function exits the queue
|
||||||
|
* will still be empty. If there are tasks blocked waiting to write to
|
||||||
|
* the queue, then one should be unblocked as after this function exits
|
||||||
|
* it will be possible to write to it. */
|
||||||
|
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
|
||||||
{
|
{
|
||||||
queueYIELD_IF_USING_PREEMPTION();
|
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
|
||||||
|
{
|
||||||
|
queueYIELD_IF_USING_PREEMPTION();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -305,16 +310,11 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mtCOVERAGE_TEST_MARKER();
|
/* Ensure the event queues start in the correct state. */
|
||||||
|
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
|
||||||
|
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Ensure the event queues start in the correct state. */
|
|
||||||
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
|
|
||||||
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue