On objects without an atomic type, the standard never defines ++ as an atomic operation.
C11 defines atomic types in stdatomic.h. If you have an atomic type object, the postfix and prefix ++ operators will define the atomic operation as a read-modify-write operation with memory_order_seq_cst semantics of the memory order.
You can also use atomic_fetch_add () if atomic increment is required.
source share