mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Changes from V4.1.2
+ Tasks that block with a timeout of portMAX_DELAY are now blocked indefinitely. Previously portMAX_DELAY was just the longest block time possible.
This commit is contained in:
parent
f7f28ed01a
commit
96d4684fa7
|
@ -181,6 +181,12 @@ Changes from V4.0.5
|
||||||
|
|
||||||
+ Added utility functions and xOverflowCount variable to facilitate the
|
+ Added utility functions and xOverflowCount variable to facilitate the
|
||||||
queue.c changes.
|
queue.c changes.
|
||||||
|
|
||||||
|
Changes from V4.1.2
|
||||||
|
|
||||||
|
+ Tasks that block with a timeout of portMAX_DELAY are now blocked
|
||||||
|
indefinitely. Previously portMAX_DELAY was just the longest block time
|
||||||
|
possible.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1418,26 +1424,36 @@ portTickType xTimeToWake;
|
||||||
is the first to be woken by the event. */
|
is the first to be woken by the event. */
|
||||||
vListInsert( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );
|
vListInsert( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );
|
||||||
|
|
||||||
/* Calculate the time at which the task should be woken if the event does
|
|
||||||
not occur. This may overflow but this doesn't matter. */
|
|
||||||
xTimeToWake = xTickCount + xTicksToWait;
|
|
||||||
|
|
||||||
/* We must remove ourselves from the ready list before adding ourselves
|
/* We must remove ourselves from the ready list before adding ourselves
|
||||||
to the blocked list as the same list item is used for both lists. We have
|
to the blocked list as the same list item is used for both lists. We have
|
||||||
exclusive access to the ready lists as the scheduler is locked. */
|
exclusive access to the ready lists as the scheduler is locked. */
|
||||||
vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
||||||
|
|
||||||
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
|
if( xTicksToWait == portMAX_DELAY )
|
||||||
|
|
||||||
if( xTimeToWake < xTickCount )
|
|
||||||
{
|
{
|
||||||
/* Wake time has overflowed. Place this item in the overflow list. */
|
/* Add ourselves to the suspended task list instead of a delayed task
|
||||||
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
list to ensure we are not woken by a timing event. We will block
|
||||||
|
indefinitely. */
|
||||||
|
vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The wake time has not overflowed, so we can use the current block list. */
|
/* Calculate the time at which the task should be woken if the event does
|
||||||
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
not occur. This may overflow but this doesn't matter. */
|
||||||
|
xTimeToWake = xTickCount + xTicksToWait;
|
||||||
|
|
||||||
|
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
|
||||||
|
|
||||||
|
if( xTimeToWake < xTickCount )
|
||||||
|
{
|
||||||
|
/* Wake time has overflowed. Place this item in the overflow list. */
|
||||||
|
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The wake time has not overflowed, so we can use the current block list. */
|
||||||
|
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue