]> git.sur5r.net Git - freertos/commitdiff
If tickless idle mode is in use then ensure prvResetNextTaskUnblockTime() is called...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 3 Jan 2020 22:50:31 +0000 (22:50 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 3 Jan 2020 22:50:31 +0000 (22:50 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2796 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/tasks.c

index c6bcb6828f3fe39baa82953d5fce5d74b5177c9f..e62b388602fcaec3178b6791d746295fb22f4be7 100644 (file)
@@ -3317,6 +3317,20 @@ TCB_t *pxUnblockedTCB;
        configASSERT( pxUnblockedTCB );\r
        ( void ) uxListRemove( pxEventListItem );\r
 \r
        configASSERT( pxUnblockedTCB );\r
        ( void ) uxListRemove( pxEventListItem );\r
 \r
+       #if( configUSE_TICKLESS_IDLE != 0 )\r
+       {\r
+               /* If a task is blocked on a kernel object then xNextTaskUnblockTime\r
+               might be set to the blocked task's time out time.  If the task is\r
+               unblocked for a reason other than a timeout xNextTaskUnblockTime is\r
+               normally left unchanged, because it is automatically reset to a new\r
+               value when the tick count equals xNextTaskUnblockTime.  However if\r
+               tickless idling is used it might be more important to enter sleep mode\r
+               at the earliest possible time - so reset xNextTaskUnblockTime here to\r
+               ensure it is updated at the earliest possible time. */\r
+               prvResetNextTaskUnblockTime();\r
+       }\r
+       #endif\r
+\r
        /* Remove the task from the delayed list and add it to the ready list.  The\r
        scheduler is suspended so interrupts will not be accessing the ready\r
        lists. */\r
        /* Remove the task from the delayed list and add it to the ready list.  The\r
        scheduler is suspended so interrupts will not be accessing the ready\r
        lists. */\r
@@ -3597,6 +3611,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
        const UBaseType_t uxNonApplicationTasks = 1;\r
        eSleepModeStatus eReturn = eStandardSleep;\r
 \r
        const UBaseType_t uxNonApplicationTasks = 1;\r
        eSleepModeStatus eReturn = eStandardSleep;\r
 \r
+               /* This function must be called from a critical section. */\r
+\r
                if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0 )\r
                {\r
                        /* A task was made ready while the scheduler was suspended. */\r
                if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0 )\r
                {\r
                        /* A task was made ready while the scheduler was suspended. */\r