Multicore and...

QNX SDP8.0Programmer's GuideDeveloper
Synchronization primitives
Standard synchronization primitives (barriers, mutexes, condvars, semaphores, and all of their derivatives) are safe to use on a multicore system. You don't have to do anything special here.
Atomic operations
If you wish to perform simple atomic operations, use the functions provided in the C include file <atomic.h>, which let you perform the following operations with memory locations in an atomic manner:
Function Operation
atomic_add() Add a number
atomic_add_value() Add a number and return the original value of *loc
atomic_clr() Clear bits
atomic_clr_value() Clear bits and return the original value of *loc
atomic_set() Set bits
atomic_set_value() Set bits and return the original value of *loc
atomic_sub() Subtract a number
atomic_sub_value() Subtract a number and return the original value of *loc
atomic_toggle() Toggle (complement) bits
atomic_toggle_value() Toggle (complement) bits and return the original value of *loc
Note:
The *_value() functions may be slower on some systems, so don't use them unless you really want the return value.
Page updated: