]> git.sur5r.net Git - freertos/commitdiff
Some optimisations added.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 11 Mar 2009 10:55:41 +0000 (10:55 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 11 Mar 2009 10:55:41 +0000 (10:55 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@704 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/tasks.c

index eb63bdefe9dc35905176c88a36e11cb6169d251e..0a363ecc01ab65472fe4b9d1be0dfd3095a6f7c1 100644 (file)
@@ -1014,9 +1014,9 @@ void vTaskEndScheduler( void )
 \r
 void vTaskSuspendAll( void )\r
 {\r
-       portENTER_CRITICAL();\r
-               ++uxSchedulerSuspended;\r
-       portEXIT_CRITICAL();\r
+       /* A critical section is not required as the variable is of type\r
+       portBASE_TYPE. */\r
+       ++uxSchedulerSuspended;\r
 }\r
 /*----------------------------------------------------------*/\r
 \r
@@ -1119,13 +1119,9 @@ portTickType xTicks;
 \r
 unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )\r
 {\r
-unsigned portBASE_TYPE uxNumberOfTasks;\r
-\r
-       taskENTER_CRITICAL();\r
-               uxNumberOfTasks = uxCurrentNumberOfTasks;\r
-       taskEXIT_CRITICAL();\r
-\r
-       return uxNumberOfTasks;\r
+       /* A critical section is not required because the variables are of type\r
+       portBASE_TYPE. */\r
+       return uxCurrentNumberOfTasks;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1351,7 +1347,8 @@ void vTaskIncrementTick( void )
                        xTCB = ( tskTCB * ) xTask;\r
                }\r
                \r
-               /* Save the hook function in the TCB. */\r
+               /* Save the hook function in the TCB.  A critical section is required as\r
+               the value can be accessed from an interrupt. */\r
                portENTER_CRITICAL();\r
                        xTCB->pxTaskTag = pxTagValue;\r
                portEXIT_CRITICAL();\r
@@ -1899,15 +1896,10 @@ tskTCB *pxNewTCB;
 \r
        xTaskHandle xTaskGetCurrentTaskHandle( void )\r
        {\r
-       xTaskHandle xReturn;\r
-\r
-               portENTER_CRITICAL();\r
-               {\r
-                       xReturn = ( xTaskHandle ) pxCurrentTCB;\r
-               }\r
-               portEXIT_CRITICAL();\r
-\r
-               return xReturn;\r
+               /* A critical section is not required as this is not called from\r
+               an interrupt and the current TCB will always be the same for any\r
+               individual execution thread. */\r
+               return pxCurrentTCB;\r
        }\r
 \r
 #endif\r