MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / vCoRoutineSchedule

Function vCoRoutineSchedule

croutine.c:282–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280/*-----------------------------------------------------------*/
281
282 void vCoRoutineSchedule( void )
283 {
284 /* Only run a co-routine after prvInitialiseCoRoutineLists() has been
285 * called. prvInitialiseCoRoutineLists() is called automatically when a
286 * co-routine is created. */
287 if( pxDelayedCoRoutineList != NULL )
288 {
289 /* See if any co-routines readied by events need moving to the ready lists. */
290 prvCheckPendingReadyList();
291
292 /* See if any delayed co-routines have timed out. */
293 prvCheckDelayedList();
294
295 /* Find the highest priority queue that contains ready co-routines. */
296 while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
297 {
298 if( uxTopCoRoutineReadyPriority == 0 )
299 {
300 /* No more co-routines to check. */
301 return;
302 }
303
304 --uxTopCoRoutineReadyPriority;
305 }
306
307 /* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
308 * of the same priority get an equal share of the processor time. */
309 listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
310
311 /* Call the co-routine. */
312 ( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
313 }
314 }
315/*-----------------------------------------------------------*/
316
317 static void prvInitialiseCoRoutineLists( void )

Callers

nothing calls this directly

Calls 2

prvCheckPendingReadyListFunction · 0.85
prvCheckDelayedListFunction · 0.85

Tested by

no test coverage detected