| 2845 | /*----------------------------------------------------------*/ |
| 2846 | |
| 2847 | void 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 ) |
no test coverage detected