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

Function xTaskAbortDelay

tasks.c:3395–3460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3393#if ( INCLUDE_xTaskAbortDelay == 1 )
3394
3395 BaseType_t xTaskAbortDelay( TaskHandle_t xTask )
3396 {
3397 TCB_t * pxTCB = xTask;
3398 BaseType_t xReturn;
3399
3400 configASSERT( pxTCB );
3401
3402 vTaskSuspendAll();
3403 {
3404 /* A task can only be prematurely removed from the Blocked state if
3405 * it is actually in the Blocked state. */
3406 if( eTaskGetState( xTask ) == eBlocked )
3407 {
3408 xReturn = pdPASS;
3409
3410 /* Remove the reference to the task from the blocked list. An
3411 * interrupt won't touch the xStateListItem because the
3412 * scheduler is suspended. */
3413 ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
3414
3415 /* Is the task waiting on an event also? If so remove it from
3416 * the event list too. Interrupts can touch the event list item,
3417 * even though the scheduler is suspended, so a critical section
3418 * is used. */
3419 taskENTER_CRITICAL();
3420 {
3421 if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
3422 {
3423 ( void ) uxListRemove( &( pxTCB->xEventListItem ) );
3424
3425 /* This lets the task know it was forcibly removed from the
3426 * blocked state so it should not re-evaluate its block time and
3427 * then block again. */
3428 pxTCB->ucDelayAborted = pdTRUE;
3429 }
3430 else
3431 {
3432 mtCOVERAGE_TEST_MARKER();
3433 }
3434 }
3435 taskEXIT_CRITICAL();
3436
3437 /* Place the unblocked task into the appropriate ready list. */
3438 prvAddTaskToReadyList( pxTCB );
3439
3440 /* A task being unblocked cannot cause an immediate context
3441 * switch if preemption is turned off. */
3442 #if ( configUSE_PREEMPTION == 1 )
3443 {
3444 taskENTER_CRITICAL();
3445 {
3446 prvYieldForTask( pxTCB, pdFALSE );
3447 }
3448 taskEXIT_CRITICAL();
3449 }
3450 #endif /* configUSE_PREEMPTION */
3451 }
3452 else

Callers 1

MPU_xTaskAbortDelayFunction · 0.85

Calls 5

vTaskSuspendAllFunction · 0.85
eTaskGetStateFunction · 0.85
uxListRemoveFunction · 0.85
prvYieldForTaskFunction · 0.85
xTaskResumeAllFunction · 0.85

Tested by

no test coverage detected