Chapter 17

Critical sections

Abstract

Critical sections (also known as critical regions) are regions of code that are surrounded by two macros where entry to these sections of code is controlled so that the code is entered by only one task at any time. A critical section is entered by calling taskENTER_CRITICAL() and exited by calling taskEXIT_CRITICAL(). These calls do not have any parameters and also do not return any values. Critical sections can also be implemented using mutexes and semaphores, but it is quicker to use the entry and exit macros described in this chapter. Interrupts are disabled inside the critical sections, either globally, or up to a specific priority level. A real-time multitasking FreeRTOS based project is given in this ...

Get ARM-Based Microcontroller Multitasking Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.