|
188 | 188 | } \
|
189 | 189 | \
|
190 | 190 | /* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
|
191 |
| - * the same priority get an equal share of the processor time. */ \ |
192 |
| - listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ |
| 191 | + * the same priority get an equal share of the processor time. */ \ |
| 192 | + listGET_OWNER_OF_NEXT_ENTRY( prvGetCurrentTaskTCBUnsafe(), &( pxReadyTasksLists[ uxTopPriority ] ) ); \ |
193 | 193 | uxTopReadyPriority = uxTopPriority; \
|
194 | 194 | } while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */
|
195 | 195 | #else /* if ( configNUMBER_OF_CORES == 1 ) */
|
|
224 | 224 | /* Find the highest priority list that contains ready tasks. */ \
|
225 | 225 | portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
|
226 | 226 | configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
|
227 |
| - listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ |
| 227 | + listGET_OWNER_OF_NEXT_ENTRY( prvGetCurrentTaskTCBUnsafe(), &( pxReadyTasksLists[ uxTopPriority ] ) ); \ |
228 | 228 | } while( 0 )
|
229 | 229 |
|
230 | 230 | /*-----------------------------------------------------------*/
|
|
307 | 307 |
|
308 | 308 | /* Returns pdTRUE if the task is actively running and not scheduled to yield. */
|
309 | 309 | #if ( configNUMBER_OF_CORES == 1 )
|
310 |
| - #define taskTASK_IS_RUNNING( pxTCB ) ( ( ( pxTCB ) == pxCurrentTCB ) ? ( pdTRUE ) : ( pdFALSE ) ) |
311 |
| - #define taskTASK_IS_RUNNING_OR_SCHEDULED_TO_YIELD( pxTCB ) ( ( ( pxTCB ) == pxCurrentTCB ) ? ( pdTRUE ) : ( pdFALSE ) ) |
| 310 | + #define taskTASK_IS_RUNNING( pxTCB ) ( ( ( pxTCB ) == prvGetCurrentTaskTCBUnsafe() ) ? ( pdTRUE ) : ( pdFALSE ) ) |
| 311 | + #define taskTASK_IS_RUNNING_OR_SCHEDULED_TO_YIELD( pxTCB ) ( ( ( pxTCB ) == prvGetCurrentTaskTCBUnsafe() ) ? ( pdTRUE ) : ( pdFALSE ) ) |
312 | 312 | #else
|
313 | 313 | #define taskTASK_IS_RUNNING( pxTCB ) ( ( ( ( pxTCB )->xTaskRunState >= ( BaseType_t ) 0 ) && ( ( pxTCB )->xTaskRunState < ( BaseType_t ) configNUMBER_OF_CORES ) ) ? ( pdTRUE ) : ( pdFALSE ) )
|
314 | 314 | #define taskTASK_IS_RUNNING_OR_SCHEDULED_TO_YIELD( pxTCB ) ( ( ( pxTCB )->xTaskRunState != taskTASK_NOT_RUNNING ) ? ( pdTRUE ) : ( pdFALSE ) )
|
@@ -2066,11 +2066,12 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
2066 | 2066 | {
|
2067 | 2067 | uxCurrentNumberOfTasks = ( UBaseType_t ) ( uxCurrentNumberOfTasks + 1U );
|
2068 | 2068 |
|
2069 |
| - if( pxCurrentTCB == NULL ) |
| 2069 | + /* Invoking a functon in a condition here for performance consideration. */ |
| 2070 | + if( prvGetCurrentTaskTCBUnsafe() == NULL ) |
2070 | 2071 | {
|
2071 | 2072 | /* There are no other tasks, or all the other tasks are in
|
2072 | 2073 | * the suspended state - make this the current task. */
|
2073 |
| - pxCurrentTCB = pxNewTCB; |
| 2074 | + prvSetCurrentTCB( pxNewTCB ); |
2074 | 2075 |
|
2075 | 2076 | if( uxCurrentNumberOfTasks == ( UBaseType_t ) 1 )
|
2076 | 2077 | {
|
@@ -3301,7 +3302,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
3301 | 3302 | * NULL so when the next task is created pxCurrentTCB will
|
3302 | 3303 | * be set to point to it no matter what its relative priority
|
3303 | 3304 | * is. */
|
3304 |
| - pxCurrentTCB = NULL; |
| 3305 | + prvSetCurrentTCB( NULL ); |
3305 | 3306 | }
|
3306 | 3307 | else
|
3307 | 3308 | {
|
@@ -4129,7 +4130,7 @@ BaseType_t xTaskResumeAll( void )
|
4129 | 4130 |
|
4130 | 4131 | #if ( configNUMBER_OF_CORES == 1 )
|
4131 | 4132 | {
|
4132 |
| - taskYIELD_TASK_CORE_IF_USING_PREEMPTION( pxCurrentTCB ); |
| 4133 | + taskYIELD_TASK_CORE_IF_USING_PREEMPTION( prvGetCurrentTaskTCBUnsafe() ); |
4133 | 4134 | }
|
4134 | 4135 | #endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
4135 | 4136 | }
|
@@ -8704,7 +8705,7 @@ void vTaskResetState( void )
|
8704 | 8705 | /* Task control block. */
|
8705 | 8706 | #if ( configNUMBER_OF_CORES == 1 )
|
8706 | 8707 | {
|
8707 |
| - pxCurrentTCB = NULL; |
| 8708 | + prvSetCurrentTCB( NULL ); |
8708 | 8709 | }
|
8709 | 8710 | #endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
8710 | 8711 |
|
|
0 commit comments