diff --git a/include/task.h b/include/task.h index 47b1cb5b1..b510189de 100644 --- a/include/task.h +++ b/include/task.h @@ -3930,14 +3930,6 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC void vKernelLightWeightExitCritical( void ); #endif -/* - * Checks whether a yield is required after portUNLOCK_DATA_GROUP() returns. - * To be called while data group is locked. - */ -#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) - BaseType_t xTaskUnlockCanYield( void ); -#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ - #if ( portUSING_MPU_WRAPPERS == 1 ) /* diff --git a/tasks.c b/tasks.c index 0aac59d1a..49170b816 100644 --- a/tasks.c +++ b/tasks.c @@ -7716,8 +7716,20 @@ static void prvResetNextTaskUnblockTime( void ) { BaseType_t xYieldCurrentTask; - /* Get the xYieldPending stats inside the critical section. */ - xYieldCurrentTask = xTaskUnlockCanYield(); + /* Get the xYieldPending status inside the critical section. */ + if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE ) + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) + && ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) && + ( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U ) + #endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ + ) + { + xYieldCurrentTask = pdTRUE; + } + else + { + xYieldCurrentTask = pdFALSE; + } /* Release the ISR and task locks first when using granular locks. */ kernelRELEASE_ISR_LOCK( xCoreID ); @@ -7872,15 +7884,27 @@ static void prvResetNextTaskUnblockTime( void ) if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U ) { + BaseType_t xYieldCurrentTask; + + if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE ) + #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) + && ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) && + ( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U ) + #endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ + ) + { + xYieldCurrentTask = pdTRUE; + } + else + { + xYieldCurrentTask = pdFALSE; + } + /* Release the ISR lock */ kernelRELEASE_ISR_LOCK( xCoreID ); portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID ); - BaseType_t xYieldCurrentTask; - - xYieldCurrentTask = xTaskUnlockCanYield(); - /* If the critical nesting count is 0, enable interrupts */ if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U ) { @@ -7898,33 +7922,6 @@ static void prvResetNextTaskUnblockTime( void ) #endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */ /*-----------------------------------------------------------*/ -#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) - - BaseType_t xTaskUnlockCanYield( void ) - { - BaseType_t xReturn; - BaseType_t xCoreID = portGET_CORE_ID(); - - if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE ) - #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) - && ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) && - ( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U ) - #endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ - ) - { - xReturn = pdTRUE; - } - else - { - xReturn = pdFALSE; - } - - return xReturn; - } - -#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ -/*-----------------------------------------------------------*/ - #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) static char * prvWriteNameToBuffer( char * pcBuffer,