\r
/* Insert a new list item into pxList, but rather than sort the list,\r
makes the new list item the last item to be removed by a call to\r
- pvListGetOwnerOfNextEntry. This means it has to be the item pointed to by\r
- the pxIndex member. */\r
+ pvListGetOwnerOfNextEntry. */\r
pxIndex = pxList->pxIndex;\r
\r
- pxNewListItem->pxNext = pxIndex->pxNext;\r
- pxNewListItem->pxPrevious = pxList->pxIndex;\r
- pxIndex->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;\r
- pxIndex->pxNext = ( volatile xListItem * ) pxNewListItem;\r
- pxList->pxIndex = ( volatile xListItem * ) pxNewListItem;\r
+ pxNewListItem->pxNext = pxIndex;\r
+ pxNewListItem->pxPrevious = pxIndex->pxPrevious;\r
+ pxIndex->pxPrevious->pxNext = ( volatile xListItem * ) pxNewListItem;\r
+ pxIndex->pxPrevious = ( volatile xListItem * ) pxNewListItem; \r
\r
/* Remember which list the item is in. */\r
pxNewListItem->pvContainer = ( void * ) pxList;\r
PRIVILEGED_DATA static xList xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */\r
PRIVILEGED_DATA static xList * volatile pxDelayedTaskList ; /*< Points to the delayed task list currently being used. */\r
PRIVILEGED_DATA static xList * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */\r
-PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready queue when the scheduler is resumed. */\r
+PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */\r
\r
#if ( INCLUDE_vTaskDelete == 1 )\r
\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- * Place the task represented by pxTCB into the appropriate ready queue for\r
- * the task. It is inserted at the end of the list. One quirk of this is\r
- * that if the task being inserted is at the same priority as the currently\r
- * executing task, then it will only be rescheduled after the currently\r
- * executing task has been rescheduled.\r
+ * Place the task represented by pxTCB into the appropriate ready list for\r
+ * the task. It is inserted at the end of the list.\r
*/\r
-#define prvAddTaskToReadyQueue( pxTCB ) \\r
+#define prvAddTaskToReadyList( pxTCB ) \\r
traceMOVED_TASK_TO_READY_STATE( pxTCB ) \\r
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \\r
vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )\r
*pxCreatedTask = ( xTaskHandle ) pxNewTCB;\r
}\r
\r
- /* We are going to manipulate the task queues to add this task to a\r
- ready list, so must make sure no interrupts occur. */\r
+ /* Ensure interrupts don't access the task lists while they are being\r
+ updated. */\r
taskENTER_CRITICAL();\r
{\r
uxCurrentNumberOfTasks++;\r
#endif /* configUSE_TRACE_FACILITY */\r
traceTASK_CREATE( pxNewTCB );\r
\r
- prvAddTaskToReadyQueue( pxNewTCB );\r
+ prvAddTaskToReadyList( pxNewTCB );\r
\r
xReturn = pdPASS;\r
portSETUP_TCB( pxNewTCB );\r
{\r
taskRESET_READY_PRIORITY( uxPriorityUsedOnEntry );\r
}\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
}\r
\r
if( xYieldRequired == pdTRUE )\r
/* As we are in a critical section we can access the ready\r
lists even if the scheduler is suspended. */\r
uxListRemove( &( pxTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
\r
/* We may have just resumed a higher priority task. */\r
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )\r
{\r
xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );\r
uxListRemove( &( pxTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
}\r
else\r
{\r
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xPendingReadyList ) );\r
uxListRemove( &( pxTCB->xEventListItem ) );\r
uxListRemove( &( pxTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
\r
/* If we have moved a task that has a priority higher than\r
the current task then we should yield. */\r
\r
/* Place the unblocked task into the appropriate ready\r
list. */\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
\r
/* A task being unblocked cannot cause an immediate context\r
switch if preemption is turned off. */\r
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
{\r
uxListRemove( &( pxUnblockedTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxUnblockedTCB );\r
+ prvAddTaskToReadyList( pxUnblockedTCB );\r
}\r
else\r
{\r
\r
/* Inherit the priority before being moved into the new list. */\r
pxTCB->uxPriority = pxCurrentTCB->uxPriority;\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
}\r
else\r
{\r
traceTASK_PRIORITY_DISINHERIT( pxTCB, pxTCB->uxBasePriority );\r
pxTCB->uxPriority = pxTCB->uxBasePriority;\r
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority );\r
- prvAddTaskToReadyQueue( pxTCB );\r
+ prvAddTaskToReadyList( pxTCB );\r
}\r
}\r
}\r