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

Function vTaskSuspendAll

tasks.c:2847–2886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2845/*----------------------------------------------------------*/
2846
2847void vTaskSuspendAll( void )
2848{
2849 UBaseType_t ulState;
2850
2851 /* This must only be called from within a task */
2852 portASSERT_IF_IN_ISR();
2853
2854 if( xSchedulerRunning != pdFALSE )
2855 {
2856 /* writes to uxSchedulerSuspended must be protected by both the task AND ISR locks.
2857 * We must disable interrupts before we grab the locks in the event that this task is
2858 * interrupted and switches context before incrementing uxSchedulerSuspended.
2859 * It is safe to re-enable interrupts after releasing the ISR lock and incrementing
2860 * uxSchedulerSuspended since that will prevent context switches. */
2861 ulState = portDISABLE_INTERRUPTS();
2862
2863 /* portSOFRWARE_BARRIER() is only implemented for emulated/simulated ports that
2864 * do not otherwise exhibit real time behaviour. */
2865 portSOFTWARE_BARRIER();
2866
2867 portGET_TASK_LOCK();
2868 portGET_ISR_LOCK();
2869
2870 /* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment
2871 * is used to allow calls to vTaskSuspendAll() to nest. */
2872 ++uxSchedulerSuspended;
2873 portRELEASE_ISR_LOCK();
2874
2875 if( ( uxSchedulerSuspended == 1U ) && ( pxCurrentTCB->uxCriticalNesting == 0U ) )
2876 {
2877 prvCheckForRunStateChange();
2878 }
2879
2880 portRESTORE_INTERRUPTS( ulState );
2881 }
2882 else
2883 {
2884 mtCOVERAGE_TEST_MARKER();
2885 }
2886}
2887/*----------------------------------------------------------*/
2888
2889#if ( configUSE_TICKLESS_IDLE != 0 )

Callers 15

xQueueGenericSendFunction · 0.85
xQueueReceiveFunction · 0.85
xQueueSemaphoreTakeFunction · 0.85
xQueuePeekFunction · 0.85
xTaskDelayUntilFunction · 0.85
vTaskDelayFunction · 0.85
xTaskGetHandleFunction · 0.85
uxTaskGetSystemStateFunction · 0.85
xTaskCatchUpTicksFunction · 0.85
xTaskAbortDelayFunction · 0.85
tasks.cFile · 0.85
vTaskGetInfoFunction · 0.85

Calls 1

Tested by

no test coverage detected