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

Function vTaskEnterCritical

tasks.c:5268–5300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5266#if ( portCRITICAL_NESTING_IN_TCB == 1 )
5267
5268 void vTaskEnterCritical( void )
5269 {
5270 portDISABLE_INTERRUPTS();
5271
5272 if( xSchedulerRunning != pdFALSE )
5273 {
5274 if( pxCurrentTCB->uxCriticalNesting == 0U )
5275 {
5276 if( portCHECK_IF_IN_ISR() == pdFALSE )
5277 {
5278 portGET_TASK_LOCK();
5279 }
5280
5281 portGET_ISR_LOCK();
5282 }
5283
5284 ( pxCurrentTCB->uxCriticalNesting )++;
5285
5286 /* This should now be interrupt safe. The only time there would be
5287 * a problem is if this is called before a context switch and
5288 * vTaskExitCritical() is called after pxCurrentTCB changes. Therefore
5289 * this should not be used within vTaskSwitchContext(). */
5290
5291 if( ( uxSchedulerSuspended == 0U ) && ( pxCurrentTCB->uxCriticalNesting == 1U ) )
5292 {
5293 prvCheckForRunStateChange();
5294 }
5295 }
5296 else
5297 {
5298 mtCOVERAGE_TEST_MARKER();
5299 }
5300 }
5301
5302#endif /* portCRITICAL_NESTING_IN_TCB */
5303/*-----------------------------------------------------------*/

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected