Skip to content

Commit b97bb48

Browse files
RichardBarryRichardBarryaggarg
authored
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>
1 parent ce81bcb commit b97bb48

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

queue.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -277,26 +277,31 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
277277
( ( SIZE_MAX / pxQueue->uxLength ) >= pxQueue->uxItemSize ) )
278278
{
279279
taskENTER_CRITICAL();
280-
281-
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
282-
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
283-
pxQueue->pcWriteTo = pxQueue->pcHead;
284-
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. */
285-
pxQueue->cRxLock = queueUNLOCKED;
286-
pxQueue->cTxLock = queueUNLOCKED;
287-
288-
if( xNewQueue == pdFALSE )
289280
{
290-
/* If there are tasks blocked waiting to read from the queue, then
291-
* the tasks will remain blocked as after this function exits the queue
292-
* will still be empty. If there are tasks blocked waiting to write to
293-
* the queue, then one should be unblocked as after this function exits
294-
* it will be possible to write to it. */
295-
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
281+
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
282+
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
283+
pxQueue->pcWriteTo = pxQueue->pcHead;
284+
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. */
285+
pxQueue->cRxLock = queueUNLOCKED;
286+
pxQueue->cTxLock = queueUNLOCKED;
287+
288+
if( xNewQueue == pdFALSE )
296289
{
297-
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
290+
/* If there are tasks blocked waiting to read from the queue, then
291+
* the tasks will remain blocked as after this function exits the queue
292+
* will still be empty. If there are tasks blocked waiting to write to
293+
* the queue, then one should be unblocked as after this function exits
294+
* it will be possible to write to it. */
295+
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
298296
{
299-
queueYIELD_IF_USING_PREEMPTION();
297+
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
298+
{
299+
queueYIELD_IF_USING_PREEMPTION();
300+
}
301+
else
302+
{
303+
mtCOVERAGE_TEST_MARKER();
304+
}
300305
}
301306
else
302307
{
@@ -305,16 +310,11 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
305310
}
306311
else
307312
{
308-
mtCOVERAGE_TEST_MARKER();
313+
/* Ensure the event queues start in the correct state. */
314+
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
315+
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
309316
}
310317
}
311-
else
312-
{
313-
/* Ensure the event queues start in the correct state. */
314-
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
315-
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
316-
}
317-
318318
taskEXIT_CRITICAL();
319319
}
320320
else

0 commit comments

Comments
 (0)