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

Function prvInitialiseMutex

queue.c:494–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492#if ( configUSE_MUTEXES == 1 )
493
494 static void prvInitialiseMutex( Queue_t * pxNewQueue )
495 {
496 if( pxNewQueue != NULL )
497 {
498 /* The queue create function will set all the queue structure members
499 * correctly for a generic queue, but this function is creating a
500 * mutex. Overwrite those members that need to be set differently -
501 * in particular the information required for priority inheritance. */
502 pxNewQueue->u.xSemaphore.xMutexHolder = NULL;
503 pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;
504
505 /* In case this is a recursive mutex. */
506 pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0;
507
508 traceCREATE_MUTEX( pxNewQueue );
509
510 /* Start with the semaphore in the expected state. */
511 ( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );
512 }
513 else
514 {
515 traceCREATE_MUTEX_FAILED();
516 }
517 }
518
519#endif /* configUSE_MUTEXES */
520/*-----------------------------------------------------------*/

Callers 2

xQueueCreateMutexFunction · 0.85
xQueueCreateMutexStaticFunction · 0.85

Calls 1

xQueueGenericSendFunction · 0.85

Tested by

no test coverage detected