mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-07-05 03:47:15 -04:00
Compare commits
6 commits
26655c7e54
...
fb77de7c81
Author | SHA1 | Date | |
---|---|---|---|
|
fb77de7c81 | ||
|
b8611c970d | ||
|
ca6db799b1 | ||
|
a03ce9c287 | ||
|
e67f1668e0 | ||
|
21f42e62a5 |
38
tasks.c
38
tasks.c
|
@ -461,7 +461,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
||||||
BaseType_t xDeferredStateChange; /**< Used to indicate if the task's state change is deferred. */
|
UBaseType_t uxDeferredStateChange; /**< Used to indicate if the task's state change is deferred. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
|
#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(). */
|
* task enables preemption. The deletion will be performed in vTaskPreemptionEnable(). */
|
||||||
if( pxTCB->uxPreemptionDisable > 0U )
|
if( pxTCB->uxPreemptionDisable > 0U )
|
||||||
{
|
{
|
||||||
pxTCB->xDeferredStateChange |= tskDEFERRED_DELETION;
|
pxTCB->uxDeferredStateChange |= tskDEFERRED_DELETION;
|
||||||
xDeferredDeletion = pdTRUE;
|
xDeferredDeletion = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3243,13 +3243,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
{
|
{
|
||||||
/* Process deferred state changes which were inflicted while
|
/* Process deferred state changes which were inflicted while
|
||||||
* preemption was disabled. */
|
* preemption was disabled. */
|
||||||
if( pxTCB->xDeferredStateChange != 0U )
|
if( pxTCB->uxDeferredStateChange != 0U )
|
||||||
{
|
{
|
||||||
if( pxTCB->xDeferredStateChange & tskDEFERRED_DELETION )
|
if( pxTCB->uxDeferredStateChange & tskDEFERRED_DELETION )
|
||||||
{
|
{
|
||||||
vTaskDelete( xTask );
|
vTaskDelete( xTask );
|
||||||
}
|
}
|
||||||
else if( pxTCB->xDeferredStateChange & tskDEFERRED_SUSPENSION )
|
else if( pxTCB->uxDeferredStateChange & tskDEFERRED_SUSPENSION )
|
||||||
{
|
{
|
||||||
vTaskSuspend( xTask );
|
vTaskSuspend( xTask );
|
||||||
}
|
}
|
||||||
|
@ -3258,7 +3258,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTCB->xDeferredStateChange = 0U;
|
pxTCB->uxDeferredStateChange = 0U;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3315,7 +3315,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
* task enables preemption. The suspension will be performed in vTaskPreemptionEnable(). */
|
* task enables preemption. The suspension will be performed in vTaskPreemptionEnable(). */
|
||||||
if( pxTCB->uxPreemptionDisable > 0U )
|
if( pxTCB->uxPreemptionDisable > 0U )
|
||||||
{
|
{
|
||||||
pxTCB->xDeferredStateChange |= tskDEFERRED_SUSPENSION;
|
pxTCB->uxDeferredStateChange |= tskDEFERRED_SUSPENSION;
|
||||||
xDeferredSuspension = pdTRUE;
|
xDeferredSuspension = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3558,6 +3558,10 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
{
|
{
|
||||||
TCB_t * const pxTCB = xTaskToResume;
|
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 );
|
traceENTER_vTaskResume( xTaskToResume );
|
||||||
|
|
||||||
/* It does not make sense to resume the calling task. */
|
/* It does not make sense to resume the calling task. */
|
||||||
|
@ -3579,6 +3583,25 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
kernelENTER_CRITICAL();
|
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 )
|
||||||
{
|
{
|
||||||
|
@ -3599,6 +3622,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
kernelEXIT_CRITICAL();
|
kernelEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue