AWS IoT Device SDK C:
Platform
Platform portability layer
|
Return to main page ↑ |
Atomic operations: small inlined functions used for atomically manipulating memory.
Unlike the other components of the platform layer, which rely on APIs provided by the host operating system, the atomics component relies on facilities provided by compilers. Many compilers, particularly recent versions that support C11 atomic features, provide compiler intrinsics for atomic operations. The header platform/include/iot_atomic.h
will select an atomic port to use based on the detected compiler. If no suitable atomic port is available, then a generic atomic port will be used. The generic atomic port is slower than native compiler ports, but will work on all systems.
To provide a new compiler port, the preprocessor constant IOT_ATOMIC_USE_PORT should be defined to 1
in the config file. When IOT_ATOMIC_USE_PORT is 1
, a new compiler port should be implemented in a file named iot_atomic_port.h
. This file should be created in platform/include/atomic/
, as it will be included with the directive #
.include
"atomic/iot_atomic_port.h"
Dependencies of the platform atomics component.