| 673 | #if ( configUSE_RECURSIVE_MUTEXES == 1 ) |
| 674 | |
| 675 | BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, |
| 676 | TickType_t xTicksToWait ) |
| 677 | { |
| 678 | BaseType_t xReturn; |
| 679 | Queue_t * const pxMutex = ( Queue_t * ) xMutex; |
| 680 | |
| 681 | configASSERT( pxMutex ); |
| 682 | |
| 683 | /* Comments regarding mutual exclusion as per those within |
| 684 | * xQueueGiveMutexRecursive(). */ |
| 685 | |
| 686 | traceTAKE_MUTEX_RECURSIVE( pxMutex ); |
| 687 | |
| 688 | if( pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() ) |
| 689 | { |
| 690 | ( pxMutex->u.xSemaphore.uxRecursiveCallCount )++; |
| 691 | xReturn = pdPASS; |
| 692 | } |
| 693 | else |
| 694 | { |
| 695 | xReturn = xQueueSemaphoreTake( pxMutex, xTicksToWait ); |
| 696 | |
| 697 | /* pdPASS will only be returned if the mutex was successfully |
| 698 | * obtained. The calling task may have entered the Blocked state |
| 699 | * before reaching here. */ |
| 700 | if( xReturn != pdFAIL ) |
| 701 | { |
| 702 | ( pxMutex->u.xSemaphore.uxRecursiveCallCount )++; |
| 703 | } |
| 704 | else |
| 705 | { |
| 706 | traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex ); |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | return xReturn; |
| 711 | } |
| 712 | |
| 713 | #endif /* configUSE_RECURSIVE_MUTEXES */ |
| 714 | /*-----------------------------------------------------------*/ |
no test coverage detected