mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-07-05 11:57:15 -04:00
Compare commits
7 commits
c3c32afa7a
...
fcdf6178e6
Author | SHA1 | Date | |
---|---|---|---|
|
fcdf6178e6 | ||
|
26655c7e54 | ||
|
95fa53c1ee | ||
|
e1f69a6763 | ||
|
cba76ba77d | ||
|
b256ca88b1 | ||
|
25c74e3d4b |
66
tasks.c
66
tasks.c
|
@ -461,7 +461,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
|||
#endif
|
||||
|
||||
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
||||
UBaseType_t uxDeferredStateChange; /**< Used to indicate if the task's state change is deferred. */
|
||||
BaseType_t xDeferredStateChange; /**< Used to indicate if the task's state change is deferred. */
|
||||
#endif
|
||||
|
||||
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
|
||||
|
@ -2309,7 +2309,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
* task enables preemption. The deletion will be performed in vTaskPreemptionEnable(). */
|
||||
if( pxTCB->uxPreemptionDisable > 0U )
|
||||
{
|
||||
pxTCB->uxDeferredStateChange |= tskDEFERRED_DELETION;
|
||||
pxTCB->xDeferredStateChange |= tskDEFERRED_DELETION;
|
||||
xDeferredDeletion = pdTRUE;
|
||||
}
|
||||
else
|
||||
|
@ -3243,13 +3243,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
{
|
||||
/* Process deferred state changes which were inflicted while
|
||||
* preemption was disabled. */
|
||||
if( pxTCB->uxDeferredStateChange != 0U )
|
||||
if( pxTCB->xDeferredStateChange != 0U )
|
||||
{
|
||||
if( pxTCB->uxDeferredStateChange & tskDEFERRED_DELETION )
|
||||
if( pxTCB->xDeferredStateChange & tskDEFERRED_DELETION )
|
||||
{
|
||||
vTaskDelete( xTask );
|
||||
}
|
||||
else if( pxTCB->uxDeferredStateChange & tskDEFERRED_SUSPENSION )
|
||||
else if( pxTCB->xDeferredStateChange & tskDEFERRED_SUSPENSION )
|
||||
{
|
||||
vTaskSuspend( xTask );
|
||||
}
|
||||
|
@ -3258,7 +3258,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
pxTCB->uxDeferredStateChange = 0U;
|
||||
pxTCB->xDeferredStateChange = 0U;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3315,7 +3315,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
* task enables preemption. The suspension will be performed in vTaskPreemptionEnable(). */
|
||||
if( pxTCB->uxPreemptionDisable > 0U )
|
||||
{
|
||||
pxTCB->uxDeferredStateChange |= tskDEFERRED_SUSPENSION;
|
||||
pxTCB->xDeferredStateChange |= tskDEFERRED_SUSPENSION;
|
||||
xDeferredSuspension = pdTRUE;
|
||||
}
|
||||
else
|
||||
|
@ -3558,10 +3558,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
{
|
||||
TCB_t * const pxTCB = xTaskToResume;
|
||||
|
||||
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
||||
BaseType_t xTaskResumed = pdFALSE;
|
||||
#endif /* #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
|
||||
|
||||
traceENTER_vTaskResume( xTaskToResume );
|
||||
|
||||
/* It does not make sense to resume the calling task. */
|
||||
|
@ -3584,43 +3580,23 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
{
|
||||
kernelENTER_CRITICAL();
|
||||
{
|
||||
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
||||
|
||||
/* If the task being resumed is in a deferred suspension state,
|
||||
* we simply clear the deferred suspension state and return. */
|
||||
if( pxTCB->uxDeferredStateChange & tskDEFERRED_SUSPENSION )
|
||||
{
|
||||
pxTCB->uxDeferredStateChange &= ~tskDEFERRED_SUSPENSION;
|
||||
xTaskResumed = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
#endif /* configUSE_TASK_PREEMPTION_DISABLE */
|
||||
|
||||
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
||||
if( xTaskResumed == pdFALSE )
|
||||
#endif /* #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
|
||||
if( prvTaskIsTaskSuspended( pxTCB ) != pdFALSE )
|
||||
{
|
||||
if( prvTaskIsTaskSuspended( pxTCB ) != pdFALSE )
|
||||
{
|
||||
traceTASK_RESUME( pxTCB );
|
||||
traceTASK_RESUME( pxTCB );
|
||||
|
||||
/* The ready list can be accessed even if the scheduler is
|
||||
* suspended because this is inside a critical section. */
|
||||
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
|
||||
prvAddTaskToReadyList( pxTCB );
|
||||
/* The ready list can be accessed even if the scheduler is
|
||||
* suspended because this is inside a critical section. */
|
||||
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
|
||||
prvAddTaskToReadyList( pxTCB );
|
||||
|
||||
/* This yield may not cause the task just resumed to run,
|
||||
* but will leave the lists in the correct state for the
|
||||
* next yield. */
|
||||
taskYIELD_ANY_CORE_IF_USING_PREEMPTION( pxTCB );
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
/* This yield may not cause the task just resumed to run,
|
||||
* but will leave the lists in the correct state for the
|
||||
* next yield. */
|
||||
taskYIELD_ANY_CORE_IF_USING_PREEMPTION( pxTCB );
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
kernelEXIT_CRITICAL();
|
||||
|
|
Loading…
Reference in a new issue