Update to FreeRTOS V6.1.0 release candidate.

This commit is contained in:
Richard Barry 2010-09-23 18:07:41 +00:00
parent 4778bd45e7
commit 86e6ede04c

View file

@ -460,15 +460,19 @@ tskTCB * pxNewTCB;
portENTER_CRITICAL();
{
uxCurrentNumberOfTasks++;
if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 )
if( pxCurrentTCB == NULL )
{
/* As this is the first task it must also be the current task. */
/* There are no other tasks, or all the other tasks are in
the suspended state - make this the current task. */
pxCurrentTCB = pxNewTCB;
/* This is the first task to be created so do the preliminary
initialisation required. We will not recover if this call
fails, but we will report the failure. */
prvInitialiseTaskLists();
if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 )
{
/* This is the first task to be created so do the preliminary
initialisation required. We will not recover if this call
fails, but we will report the failure. */
prvInitialiseTaskLists();
}
}
else
{
@ -893,10 +897,31 @@ tskTCB * pxNewTCB;
}
portEXIT_CRITICAL();
/* We may have just suspended the current task. */
if( ( ( void * ) pxTaskToSuspend == NULL ) && ( xSchedulerRunning != pdFALSE ) )
if( ( void * ) pxTaskToSuspend == NULL )
{
portYIELD_WITHIN_API();
if( xSchedulerRunning != pdFALSE )
{
/* We have just suspended the current task. */
portYIELD_WITHIN_API();
}
else
{
/* The scheduler is not running, but the task that was pointed
to by pxCurrentTCB has just been suspended and pxCurrentTCB
must be adjusted to point to a different task. */
if( uxCurrentNumberOfTasks == 1 )
{
/* No other tasks are defined, so set pxCurrentTCB back to
NULL so when the next task is created pxCurrentTCB will
be set to point to it no matter what its relative priority
is. */
pxCurrentTCB = NULL;
}
else
{
vTaskSwitchContext();
}
}
}
}