Amazon FreeRTOS
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Amazon FreeRTOS Atomic Operations


Atomic operations ensure non-blocking synchronization in concurrent programming. You can use atomic operations to solve performance issues that are caused by asynchronous operations that act on shared memory. Amazon FreeRTOS supports atomic operations, as implemented in the iot_atomic.h header file.

The iot_atomic.h header file includes two implementations for atomic operations:

  • Disabling interrupt globally.

    This implementation is available to all Amazon FreeRTOS platforms.

  • ISA native atomic support.

    This implementation is only available to platforms that compile with GCC, version 4.7.0 and higher, and have ISA atomic support. For information about GCC built-in functions, see Built-in Functions for Memory Model Aware Atomic Operations.


Before you use Amazon FreeRTOS Atomic Operations, you need to choose which implementation of atomic operations that you want to use.

  1. Open FreeRTOSConfig.h configuration file for edit.

  2. For the ISA native atomic support implementation, define and set the configUSE_ATOMIC_INSTRUCTION variable to 1.

    For the disabling global interrupt implementation, undefine or clear configUSE_ATOMIC_INSTRUCTION.

API Reference

For a full API reference, see Atomic Operations C SDK API Reference.