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

Function xTaskRemoveFromEventList

tasks.c:3968–4027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3966/*-----------------------------------------------------------*/
3967
3968BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList )
3969{
3970 TCB_t * pxUnblockedTCB;
3971 BaseType_t xReturn;
3972
3973 /* THIS FUNCTION MUST BE CALLED FROM A CRITICAL SECTION. It can also be
3974 * called from a critical section within an ISR. */
3975
3976 /* The event list is sorted in priority order, so the first in the list can
3977 * be removed as it is known to be the highest priority. Remove the TCB from
3978 * the delayed list, and add it to the ready list.
3979 *
3980 * If an event is for a queue that is locked then this function will never
3981 * get called - the lock count on the queue will get modified instead. This
3982 * means exclusive access to the event list is guaranteed here.
3983 *
3984 * This function assumes that a check has already been made to ensure that
3985 * pxEventList is not empty. */
3986 pxUnblockedTCB = listGET_OWNER_OF_HEAD_ENTRY( pxEventList ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
3987 configASSERT( pxUnblockedTCB );
3988 ( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) );
3989
3990 if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
3991 {
3992 ( void ) uxListRemove( &( pxUnblockedTCB->xStateListItem ) );
3993 prvAddTaskToReadyList( pxUnblockedTCB );
3994
3995 #if ( configUSE_TICKLESS_IDLE != 0 )
3996 {
3997 /* If a task is blocked on a kernel object then xNextTaskUnblockTime
3998 * might be set to the blocked task's time out time. If the task is
3999 * unblocked for a reason other than a timeout xNextTaskUnblockTime is
4000 * normally left unchanged, because it is automatically reset to a new
4001 * value when the tick count equals xNextTaskUnblockTime. However if
4002 * tickless idling is used it might be more important to enter sleep mode
4003 * at the earliest possible time - so reset xNextTaskUnblockTime here to
4004 * ensure it is updated at the earliest possible time. */
4005 prvResetNextTaskUnblockTime();
4006 }
4007 #endif
4008 }
4009 else
4010 {
4011 /* The delayed and ready lists cannot be accessed, so hold this task
4012 * pending until the scheduler is resumed. */
4013 vListInsertEnd( &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );
4014 }
4015
4016 xReturn = pdFALSE;
4017 #if ( configUSE_PREEMPTION == 1 )
4018 prvYieldForTask( pxUnblockedTCB, pdFALSE );
4019
4020 if( xYieldPendings[ portGET_CORE_ID() ] != pdFALSE )
4021 {
4022 xReturn = pdTRUE;
4023 }
4024 #endif
4025

Callers 10

xQueueGenericResetFunction · 0.85
xQueueGenericSendFunction · 0.85
xQueueGenericSendFromISRFunction · 0.85
xQueueGiveFromISRFunction · 0.85
xQueueReceiveFunction · 0.85
xQueueSemaphoreTakeFunction · 0.85
xQueuePeekFunction · 0.85
xQueueReceiveFromISRFunction · 0.85
prvUnlockQueueFunction · 0.85

Calls 4

uxListRemoveFunction · 0.85
vListInsertEndFunction · 0.85
prvYieldForTaskFunction · 0.85

Tested by

no test coverage detected