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

Function vTaskDelay

tasks.c:1853–1891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1851#if ( INCLUDE_vTaskDelay == 1 )
1852
1853 void vTaskDelay( const TickType_t xTicksToDelay )
1854 {
1855 BaseType_t xAlreadyYielded = pdFALSE;
1856
1857 /* A delay time of zero just forces a reschedule. */
1858 if( xTicksToDelay > ( TickType_t ) 0U )
1859 {
1860 vTaskSuspendAll();
1861 {
1862 configASSERT( uxSchedulerSuspended == 1 );
1863 traceTASK_DELAY();
1864
1865 /* A task that is removed from the event list while the
1866 * scheduler is suspended will not get placed in the ready
1867 * list or removed from the blocked list until the scheduler
1868 * is resumed.
1869 *
1870 * This task cannot be in an event list as it is the currently
1871 * executing task. */
1872 prvAddCurrentTaskToDelayedList( xTicksToDelay, pdFALSE );
1873 }
1874 xAlreadyYielded = xTaskResumeAll();
1875 }
1876 else
1877 {
1878 mtCOVERAGE_TEST_MARKER();
1879 }
1880
1881 /* Force a reschedule if xTaskResumeAll has not already done so, we may
1882 * have put ourselves to sleep. */
1883 if( xAlreadyYielded == pdFALSE )
1884 {
1885 vTaskYieldWithinAPI();
1886 }
1887 else
1888 {
1889 mtCOVERAGE_TEST_MARKER();
1890 }
1891 }
1892
1893#endif /* INCLUDE_vTaskDelay */
1894/*-----------------------------------------------------------*/

Callers 2

MPU_vTaskDelayFunction · 0.85

Calls 4

vTaskSuspendAllFunction · 0.85
xTaskResumeAllFunction · 0.85
vTaskYieldWithinAPIFunction · 0.85

Tested by

no test coverage detected