Skip to content

Commit 9000208

Browse files
feat(freertos-smp): Remove xTaskUnlockCanYield() and make it inline
1 parent 829d8ba commit 9000208

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

include/task.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,14 +3930,6 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC
39303930
void vKernelLightWeightExitCritical( void );
39313931
#endif
39323932

3933-
/*
3934-
* Checks whether a yield is required after portUNLOCK_DATA_GROUP() returns.
3935-
* To be called while data group is locked.
3936-
*/
3937-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
3938-
BaseType_t xTaskUnlockCanYield( void );
3939-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
3940-
39413933
#if ( portUSING_MPU_WRAPPERS == 1 )
39423934

39433935
/*

tasks.c

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7716,8 +7716,20 @@ static void prvResetNextTaskUnblockTime( void )
77167716
{
77177717
BaseType_t xYieldCurrentTask;
77187718

7719-
/* Get the xYieldPending stats inside the critical section. */
7720-
xYieldCurrentTask = xTaskUnlockCanYield();
7719+
/* Get the xYieldPending status inside the critical section. */
7720+
if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE )
7721+
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
7722+
&& ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) &&
7723+
( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U )
7724+
#endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
7725+
)
7726+
{
7727+
xYieldCurrentTask = pdTRUE;
7728+
}
7729+
else
7730+
{
7731+
xYieldCurrentTask = pdFALSE;
7732+
}
77217733

77227734
/* Release the ISR and task locks first when using granular locks. */
77237735
kernelRELEASE_ISR_LOCK( xCoreID );
@@ -7872,15 +7884,27 @@ static void prvResetNextTaskUnblockTime( void )
78727884

78737885
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U )
78747886
{
7887+
BaseType_t xYieldCurrentTask;
7888+
7889+
if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE )
7890+
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
7891+
&& ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) &&
7892+
( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U )
7893+
#endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
7894+
)
7895+
{
7896+
xYieldCurrentTask = pdTRUE;
7897+
}
7898+
else
7899+
{
7900+
xYieldCurrentTask = pdFALSE;
7901+
}
7902+
78757903
/* Release the ISR lock */
78767904
kernelRELEASE_ISR_LOCK( xCoreID );
78777905

78787906
portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID );
78797907

7880-
BaseType_t xYieldCurrentTask;
7881-
7882-
xYieldCurrentTask = xTaskUnlockCanYield();
7883-
78847908
/* If the critical nesting count is 0, enable interrupts */
78857909
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
78867910
{
@@ -7898,33 +7922,6 @@ static void prvResetNextTaskUnblockTime( void )
78987922
#endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */
78997923
/*-----------------------------------------------------------*/
79007924

7901-
#if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
7902-
7903-
BaseType_t xTaskUnlockCanYield( void )
7904-
{
7905-
BaseType_t xReturn;
7906-
BaseType_t xCoreID = portGET_CORE_ID();
7907-
7908-
if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE )
7909-
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
7910-
&& ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) &&
7911-
( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U )
7912-
#endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
7913-
)
7914-
{
7915-
xReturn = pdTRUE;
7916-
}
7917-
else
7918-
{
7919-
xReturn = pdFALSE;
7920-
}
7921-
7922-
return xReturn;
7923-
}
7924-
7925-
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
7926-
/*-----------------------------------------------------------*/
7927-
79287925
#if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
79297926

79307927
static char * prvWriteNameToBuffer( char * pcBuffer,

0 commit comments

Comments
 (0)