Merge branch 'zim-cherrypicked-coroutine' into 'master'

freertos: upgrade to 10.4.3 - vCoRoutineSchedule fix

See merge request espressif/esp-idf!14942
This commit is contained in:
Zim Kalinowski
2021-08-30 04:46:28 +00:00

View File

@@ -281,31 +281,36 @@
void vCoRoutineSchedule( void ) void vCoRoutineSchedule( void )
{ {
/* See if any co-routines readied by events need moving to the ready lists. */ /* Only run a co-routine after prvInitialiseCoRoutineLists() has been
prvCheckPendingReadyList(); * called. prvInitialiseCoRoutineLists() is called automatically when a
* co-routine is created. */
/* See if any delayed co-routines have timed out. */ if( pxDelayedCoRoutineList != NULL )
prvCheckDelayedList();
/* Find the highest priority queue that contains ready co-routines. */
while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
{ {
if( uxTopCoRoutineReadyPriority == 0 ) /* See if any co-routines readied by events need moving to the ready lists. */
prvCheckPendingReadyList();
/* See if any delayed co-routines have timed out. */
prvCheckDelayedList();
/* Find the highest priority queue that contains ready co-routines. */
while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
{ {
/* No more co-routines to check. */ if( uxTopCoRoutineReadyPriority == 0 )
return; {
/* No more co-routines to check. */
return;
}
--uxTopCoRoutineReadyPriority;
} }
--uxTopCoRoutineReadyPriority;
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
* of the same priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
/* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
} }
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
* of the same priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
/* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
return;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/