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

Function prvUnlockQueue

queue.c:2234–2351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2232/*-----------------------------------------------------------*/
2233
2234static void prvUnlockQueue( Queue_t * const pxQueue )
2235{
2236 /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */
2237
2238 /* The lock counts contains the number of extra data items placed or
2239 * removed from the queue while the queue was locked. When a queue is
2240 * locked items can be added or removed, but the event lists cannot be
2241 * updated. */
2242 taskENTER_CRITICAL();
2243 {
2244 int8_t cTxLock = pxQueue->cTxLock;
2245
2246 /* See if data was added to the queue while it was locked. */
2247 while( cTxLock > queueLOCKED_UNMODIFIED )
2248 {
2249 /* Data was posted while the queue was locked. Are any tasks
2250 * blocked waiting for data to become available? */
2251 #if ( configUSE_QUEUE_SETS == 1 )
2252 {
2253 if( pxQueue->pxQueueSetContainer != NULL )
2254 {
2255 if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE )
2256 {
2257 /* The queue is a member of a queue set, and posting to
2258 * the queue set caused a higher priority task to unblock.
2259 * A context switch is required. */
2260 vTaskMissedYield();
2261 }
2262 else
2263 {
2264 mtCOVERAGE_TEST_MARKER();
2265 }
2266 }
2267 else
2268 {
2269 /* Tasks that are removed from the event list will get
2270 * added to the pending ready list as the scheduler is still
2271 * suspended. */
2272 if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
2273 {
2274 if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
2275 {
2276 /* The task waiting has a higher priority so record that a
2277 * context switch is required. */
2278 vTaskMissedYield();
2279 }
2280 else
2281 {
2282 mtCOVERAGE_TEST_MARKER();
2283 }
2284 }
2285 else
2286 {
2287 break;
2288 }
2289 }
2290 }
2291 #else /* configUSE_QUEUE_SETS */

Callers 5

xQueueGenericSendFunction · 0.85
xQueueReceiveFunction · 0.85
xQueueSemaphoreTakeFunction · 0.85
xQueuePeekFunction · 0.85

Calls 3

vTaskMissedYieldFunction · 0.85
xTaskRemoveFromEventListFunction · 0.85

Tested by

no test coverage detected