c:c_threads:protected_access_to_shared_data_or_shared_resources:atomic_read_write
C - C++ Threads - Protected access to shared data or shared resources - Atomic Read & Write
Since C++ 11. Also called lockless.
Atomic ensures no races are to be expected while accessing a variable.
NOTE: The syntax can result in a very compact code, which may not be obvious that it actually involves the overhead of atomic operations.
For instance:
some_variable++
The implementation is strongly dependent on the CPU architecture and its support.
c/c_threads/protected_access_to_shared_data_or_shared_resources/atomic_read_write.txt · Last modified: 2021/06/08 09:39 by peter