diff --git a/tasks.c b/tasks.c index 3c97d3c2f..3675e9a76 100644 --- a/tasks.c +++ b/tasks.c @@ -4899,7 +4899,12 @@ BaseType_t xTaskIncrementTick( void ) { if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > 1U ) { - xYieldPendings[ xCoreID ] = pdTRUE; + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) + if( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable == pdFALSE ) + #endif + { + xYieldPendings[ xCoreID ] = pdTRUE; + } } else { @@ -5231,6 +5236,16 @@ BaseType_t xTaskIncrementTick( void ) * SMP port. */ configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 ); + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) + if( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable != pdFALSE ) + { + /* The current task has preemption disabled - do not allow a + * context switch. The yield will be performed when preemption + * is re-enabled. */ + xYieldPendings[ xCoreID ] = pdTRUE; + } + else + #endif /* #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ if( uxSchedulerSuspended != ( UBaseType_t ) 0U ) { /* The scheduler is currently suspended - do not allow a context