File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 899
899
/* Return true as the task was preempted */
900
900
xReturn = pdTRUE ;
901
901
}
902
+ else if ( xTaskHigherPriorityTasksReady () == pdTRUE )
903
+ {
904
+ /* Higher priority tasks are ready to run */
905
+ taskYIELD_WITHIN_API ();
906
+
907
+ xReturn = pdTRUE ;
908
+ }
902
909
else
903
910
{
904
911
/* Return false as the task was not preempted */
Original file line number Diff line number Diff line change @@ -3883,6 +3883,16 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC
3883
3883
BaseType_t xTaskUnlockCanYield ( void );
3884
3884
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
3885
3885
3886
+ /*
3887
+ * Returns pdTRUE if there are higher priority tasks ready to run
3888
+ * on the current core than the current task. This is intended for
3889
+ * use by kernel objects (like event groups) that need to make
3890
+ * yield decisions when unlocking.
3891
+ */
3892
+ #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
3893
+ BaseType_t xTaskHigherPriorityTasksReady ( void );
3894
+ #endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
3895
+
3886
3896
#if ( portUSING_MPU_WRAPPERS == 1 )
3887
3897
3888
3898
/*
Original file line number Diff line number Diff line change @@ -8048,6 +8048,36 @@ static void prvResetNextTaskUnblockTime( void )
8048
8048
#endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
8049
8049
/*-----------------------------------------------------------*/
8050
8050
8051
+ #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
8052
+
8053
+ BaseType_t xTaskHigherPriorityTasksReady ( void )
8054
+ {
8055
+ BaseType_t xReturn = pdFALSE ;
8056
+ BaseType_t xCoreID = portGET_CORE_ID ();
8057
+
8058
+ /* Only check if scheduler is running and not suspended */
8059
+ if ( ( xSchedulerRunning != pdFALSE ) && ( uxSchedulerSuspended == pdFALSE ) )
8060
+ {
8061
+ #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
8062
+ if ( pxCurrentTCBs [ xCoreID ]-> uxPreemptionDisable == 0U )
8063
+ #endif
8064
+ {
8065
+ UBaseType_t uxCurrentPriority = pxCurrentTCBs [ xCoreID ]-> uxPriority ;
8066
+
8067
+ /* Simple check: is top ready priority higher than current? */
8068
+ if ( uxTopReadyPriority > uxCurrentPriority )
8069
+ {
8070
+ xReturn = pdTRUE ;
8071
+ }
8072
+ }
8073
+ }
8074
+
8075
+ return xReturn ;
8076
+ }
8077
+
8078
+ #endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
8079
+ /*-----------------------------------------------------------*/
8080
+
8051
8081
#if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
8052
8082
8053
8083
static char * prvWriteNameToBuffer ( char * pcBuffer ,
You can’t perform that action at this time.
0 commit comments