diff options
author | RichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2> | 2009-03-11 10:55:41 +0000 |
---|---|---|
committer | RichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2> | 2009-03-11 10:55:41 +0000 |
commit | 7d1cc21a1dde9236a63083fa828ae7ff66d122bb (patch) | |
tree | 6a14715922cc60db5da17eaa483ae13f1ed7721c | |
parent | ba4707960248025ca135fa06171adab6746f3a2d (diff) | |
download | freertos-7d1cc21a1dde9236a63083fa828ae7ff66d122bb.tar.gz freertos-7d1cc21a1dde9236a63083fa828ae7ff66d122bb.tar.bz2 freertos-7d1cc21a1dde9236a63083fa828ae7ff66d122bb.tar.xz |
Some optimisations added.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@704 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
-rw-r--r-- | Source/tasks.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/Source/tasks.c b/Source/tasks.c index eb63bdef..0a363ecc 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -1014,9 +1014,9 @@ void vTaskEndScheduler( void ) void vTaskSuspendAll( void )
{
- portENTER_CRITICAL();
- ++uxSchedulerSuspended;
- portEXIT_CRITICAL();
+ /* A critical section is not required as the variable is of type
+ portBASE_TYPE. */
+ ++uxSchedulerSuspended;
}
/*----------------------------------------------------------*/
@@ -1119,13 +1119,9 @@ portTickType xTicks; unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
{
-unsigned portBASE_TYPE uxNumberOfTasks;
-
- taskENTER_CRITICAL();
- uxNumberOfTasks = uxCurrentNumberOfTasks;
- taskEXIT_CRITICAL();
-
- return uxNumberOfTasks;
+ /* A critical section is not required because the variables are of type
+ portBASE_TYPE. */
+ return uxCurrentNumberOfTasks;
}
/*-----------------------------------------------------------*/
@@ -1351,7 +1347,8 @@ void vTaskIncrementTick( void ) xTCB = ( tskTCB * ) xTask;
}
- /* Save the hook function in the TCB. */
+ /* Save the hook function in the TCB. A critical section is required as
+ the value can be accessed from an interrupt. */
portENTER_CRITICAL();
xTCB->pxTaskTag = pxTagValue;
portEXIT_CRITICAL();
@@ -1899,15 +1896,10 @@ tskTCB *pxNewTCB; xTaskHandle xTaskGetCurrentTaskHandle( void )
{
- xTaskHandle xReturn;
-
- portENTER_CRITICAL();
- {
- xReturn = ( xTaskHandle ) pxCurrentTCB;
- }
- portEXIT_CRITICAL();
-
- return xReturn;
+ /* A critical section is not required as this is not called from
+ an interrupt and the current TCB will always be the same for any
+ individual execution thread. */
+ return pxCurrentTCB;
}
#endif
|