@@ -394,7 +394,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
394
394
char pcTaskName [ configMAX_TASK_NAME_LEN ]; /**< Descriptive name given to the task when created. Facilitates debugging only. */
395
395
396
396
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
397
- BaseType_t xPreemptionDisable ; /**< Used to prevent the task from being preempted. */
397
+ UBaseType_t xPreemptionDisable ; /**< Used to prevent the task from being preempted. */
398
398
#endif
399
399
400
400
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
@@ -941,7 +941,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
941
941
#endif
942
942
{
943
943
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
944
- if ( pxCurrentTCBs [ xCoreID ]-> xPreemptionDisable == pdFALSE )
944
+ if ( pxCurrentTCBs [ xCoreID ]-> xPreemptionDisable == 0U )
945
945
#endif
946
946
{
947
947
xLowestPriorityToPreempt = xCurrentCoreTaskPriority ;
@@ -1247,7 +1247,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
1247
1247
( xYieldPendings [ uxCore ] == pdFALSE ) )
1248
1248
{
1249
1249
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1250
- if ( pxCurrentTCBs [ uxCore ]-> xPreemptionDisable == pdFALSE )
1250
+ if ( pxCurrentTCBs [ uxCore ]-> xPreemptionDisable == 0U )
1251
1251
#endif
1252
1252
{
1253
1253
xLowestPriority = xTaskPriority ;
@@ -2880,7 +2880,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
2880
2880
* there may now be another task of higher priority that
2881
2881
* is ready to execute. */
2882
2882
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
2883
- if ( pxTCB -> xPreemptionDisable == pdFALSE )
2883
+ if ( pxTCB -> xPreemptionDisable == 0U )
2884
2884
#endif
2885
2885
{
2886
2886
xYieldRequired = pdTRUE ;
@@ -3101,7 +3101,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
3101
3101
pxTCB = prvGetTCBFromHandle ( xTask );
3102
3102
configASSERT ( pxTCB != NULL );
3103
3103
3104
- pxTCB -> xPreemptionDisable = pdTRUE ;
3104
+ pxTCB -> xPreemptionDisable ++ ;
3105
3105
}
3106
3106
taskEXIT_CRITICAL ();
3107
3107
@@ -3124,12 +3124,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
3124
3124
{
3125
3125
pxTCB = prvGetTCBFromHandle ( xTask );
3126
3126
configASSERT ( pxTCB != NULL );
3127
+ configASSERT ( pxTCB -> xPreemptionDisable > 0U );
3127
3128
3128
- pxTCB -> xPreemptionDisable = pdFALSE ;
3129
+ pxTCB -> xPreemptionDisable -- ;
3129
3130
3130
3131
if ( xSchedulerRunning != pdFALSE )
3131
3132
{
3132
- if ( taskTASK_IS_RUNNING ( pxTCB ) == pdTRUE )
3133
+ if ( ( pxTCB -> xPreemptionDisable == 0U ) && ( taskTASK_IS_RUNNING ( pxTCB ) == pdTRUE ) )
3133
3134
{
3134
3135
xCoreID = ( BaseType_t ) pxTCB -> xTaskRunState ;
3135
3136
prvYieldCore ( xCoreID );
@@ -4928,7 +4929,7 @@ BaseType_t xTaskIncrementTick( void )
4928
4929
for ( xCoreID = 0 ; xCoreID < ( BaseType_t ) configNUMBER_OF_CORES ; xCoreID ++ )
4929
4930
{
4930
4931
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
4931
- if ( pxCurrentTCBs [ xCoreID ]-> xPreemptionDisable == pdFALSE )
4932
+ if ( pxCurrentTCBs [ xCoreID ]-> xPreemptionDisable == 0U )
4932
4933
#endif
4933
4934
{
4934
4935
if ( xYieldPendings [ xCoreID ] != pdFALSE )
0 commit comments