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

Function prvCheckDelayedList

croutine.c:223–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221/*-----------------------------------------------------------*/
222
223 static void prvCheckDelayedList( void )
224 {
225 CRCB_t * pxCRCB;
226
227 xPassedTicks = xTaskGetTickCount() - xLastTickCount;
228
229 while( xPassedTicks )
230 {
231 xCoRoutineTickCount++;
232 xPassedTicks--;
233
234 /* If the tick count has overflowed we need to swap the ready lists. */
235 if( xCoRoutineTickCount == 0 )
236 {
237 List_t * pxTemp;
238
239 /* Tick count has overflowed so we need to swap the delay lists. If there are
240 * any items in pxDelayedCoRoutineList here then there is an error! */
241 pxTemp = pxDelayedCoRoutineList;
242 pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
243 pxOverflowDelayedCoRoutineList = pxTemp;
244 }
245
246 /* See if this tick has made a timeout expire. */
247 while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
248 {
249 pxCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
250
251 if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
252 {
253 /* Timeout not yet expired. */
254 break;
255 }
256
257 portDISABLE_INTERRUPTS();
258 {
259 /* The event could have occurred just before this critical
260 * section. If this is the case then the generic list item will
261 * have been moved to the pending ready list and the following
262 * line is still valid. Also the pvContainer parameter will have
263 * been set to NULL so the following lines are also valid. */
264 ( void ) uxListRemove( &( pxCRCB->xGenericListItem ) );
265
266 /* Is the co-routine waiting on an event also? */
267 if( pxCRCB->xEventListItem.pxContainer )
268 {
269 ( void ) uxListRemove( &( pxCRCB->xEventListItem ) );
270 }
271 }
272 portENABLE_INTERRUPTS();
273
274 prvAddCoRoutineToReadyQueue( pxCRCB );
275 }
276 }
277
278 xLastTickCount = xCoRoutineTickCount;
279 }
280/*-----------------------------------------------------------*/

Callers 1

vCoRoutineScheduleFunction · 0.85

Calls 2

xTaskGetTickCountFunction · 0.85
uxListRemoveFunction · 0.85

Tested by

no test coverage detected