]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/tasks.c
Simply some of the alignment calculations in heap_4.c to match those used in heap_5.c.
[freertos] / FreeRTOS / Source / tasks.c
index 0147ad0b07515d49cc44309e16e9e663151cb462..1ef6523c9ab4d61df827bc0c2dc0bc896e0405ee 100644 (file)
@@ -3265,17 +3265,10 @@ TCB_t *pxTCB;
                                        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
@@ -3591,14 +3584,24 @@ TickType_t uxReturn;
 \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