Example usage: /* A function that makes use of a critical section. */ void vDemoFunction( void ) { /* Enter the critical section. In this example, this function is itself called from within a critical section, so entering this critical section will result in a nesting depth of 2. */ taskENTER_CRITICAL(); /* Perform the action that is being protected by the critical section here. */ /* Exit the critical section. In this example, this function is itself called from a critical section, so this call to taskEXIT_CRITICAL() will decrement the nesting count by one, but not result in interrupts becoming enabled. */ taskEXIT_CRITICAL(); } /* A task that calls vDemoFunction() from within a critical section. */ void vTask1( void * pvParameters ) { for( ;; ) { /* Perform some functionality here. */ /* Call taskENTER_CRITICAL() to create a critical section. */ taskENTER_CRITICAL(); /* Execute the code that requires the critical section here. */ /* Calls to taskENTER_CRITICAL() can be nested so it is safe to call a function that includes its own calls to taskENTER_CRITICAL() and taskEXIT_CRITICAL(). */ vDemoFunction(); /* The operation that required the critical section is complete so exit the critical section. After this call to taskEXIT_CRITICAL(), the nesting depth will be zero, so interrupts will have been re-enabled. */ taskEXIT_CRITICAL(); } }
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|
Latest News
NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS. Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019 Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed. View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS. Careers
FreeRTOS and other embedded software careers at AWS. FreeRTOS Partners
|