traceTASK_PRIORITY_DISINHERIT( pxTCB, pxTCB->uxBasePriority );\r
pxTCB->uxPriority = pxTCB->uxBasePriority;\r
\r
- /* Only reset the event list item value if the value is not\r
- being used for anything else. */\r
- if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL )\r
- {\r
- listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
- }\r
- else\r
- {\r
-#warning Is it possible to come through here?\r
- mtCOVERAGE_TEST_MARKER();\r
- }\r
+ /* Reset the event list item value. It cannot be in use for\r
+ any other purpose if this task is running, and it must be\r
+ running to give back the mutex. */\r
+ listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
prvAddTaskToReadyList( pxTCB );\r
\r
/* Return true to indicate that a context switch is required.\r
\r
void vTaskIncrementMutexHeldCount( void )\r
{\r
- ( pxCurrentTCB->uxMutexesHeld )++;\r
+ /* If xSemaphoreCreateMutex() is called before any tasks have been created\r
+ then pxCurrentTCB will be NULL. */\r
+ if( pxCurrentTCB != NULL )\r
+ {\r
+ ( pxCurrentTCB->uxMutexesHeld )++;\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vTaskDecrementMutexHeldCount( void )\r
{\r
- configASSERT( pxCurrentTCB->uxMutexesHeld );\r
- ( pxCurrentTCB->uxMutexesHeld )--;\r
+ /* If xSemaphoreCreateMutex() is called before any tasks have been created\r
+ then pxCurrentTCB will be NULL. */\r
+ if( pxCurrentTCB != NULL )\r
+ {\r
+ configASSERT( pxCurrentTCB->uxMutexesHeld );\r
+ ( pxCurrentTCB->uxMutexesHeld )--;\r
+ }\r
}\r
\r
#ifdef FREERTOS_MODULE_TEST\r