Synchronization via atomic operations
QNX SDP8.0System ArchitectureDeveloperUser
In some cases, you may want to perform a short operation (such as incrementing a variable) with the guarantee that the operation will perform atomically—that is, the operation won't be preempted by another thread or parallel execution on different cores in SMP.
The QNX OS provides atomic operations for:
- adding a value
- subtracting a value
- clearing bits
- setting bits
- toggling (complementing) bits
These atomic operations are available by including the C header file <atomic.h>.
Atomic operations are useful between two threads (SMP or single-processor).
Page updated: