MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / vQueueWaitForMessageRestricted

Function vQueueWaitForMessageRestricted

queue.c:2822–2855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2820#if ( configUSE_TIMERS == 1 )
2821
2822 void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
2823 TickType_t xTicksToWait,
2824 const BaseType_t xWaitIndefinitely )
2825 {
2826 Queue_t * const pxQueue = xQueue;
2827
2828 /* This function should not be called by application code hence the
2829 * 'Restricted' in its name. It is not part of the public API. It is
2830 * designed for use by kernel code, and has special calling requirements.
2831 * It can result in vListInsert() being called on a list that can only
2832 * possibly ever have one item in it, so the list will be fast, but even
2833 * so it should be called with the scheduler locked and not from a critical
2834 * section. */
2835
2836 /* Only do anything if there are no messages in the queue. This function
2837 * will not actually cause the task to block, just place it on a blocked
2838 * list. It will not block until the scheduler is unlocked - at which
2839 * time a yield will be performed. If an item is added to the queue while
2840 * the queue is locked, and the calling task blocks on the queue, then the
2841 * calling task will be immediately unblocked when the queue is unlocked. */
2842 prvLockQueue( pxQueue );
2843
2844 if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U )
2845 {
2846 /* There is nothing in the queue, block for the specified period. */
2847 vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait, xWaitIndefinitely );
2848 }
2849 else
2850 {
2851 mtCOVERAGE_TEST_MARKER();
2852 }
2853
2854 prvUnlockQueue( pxQueue );
2855 }
2856
2857#endif /* configUSE_TIMERS */
2858/*-----------------------------------------------------------*/

Callers 1

Calls 2

prvUnlockQueueFunction · 0.85

Tested by

no test coverage detected