Synchronization Primitives

The synchronization primitives listed below should be available to applications in the LSB Build Environment for Itanium™. These intrinsic functions need not be provided in any system library, and the compiler may treat these as inline functions in all cases. See Intel® Itanium ™ Processor-specific Application Binary Interface, Chapter 7.4 for details.

Table C-2. Intrinsic Functions

SymbolDescription
__sync_fetch_and_addAtomically add a value to a referenced location and return the previous value
__sync_fetch_and_subAtomically subtract a value from a referenced location and return the previous value
__sync_fetch_and_orAtomically bitwise or a value with a referenced location and return the previous value
__sync_fetch_and_andAtomically bitwise and a value with a referenced location and return the previous value
__sync_fetch_and_xorAtomically bitwise exclusive or a value with a referenced location and return the previous value
__sync_fetch_and_nandAtomically bitwise not-and a value with a referenced location and return the previous value
__sync_add_and_fetchAtomically add a value to a referenced location and return the new value
__sync_sub_and_fetchAtomically subtract a value from a referenced location and return the new value
__sync_or_and_fetchAtomically bitwise or a value with a referenced location and return the new value
__sync_and_and_fetchAtomically bitwise and a value with a referenced location and return the new value
__sync_xor_and_fetchAtomically bitwise exclusive or a value with a referenced location and return the new value
__sync_nand_and_fetchAtomically bitwise not-and a value with a referenced location and return the new value
__sync_bool_compare_and_swapAtomically compare a referenced location with a given value. If equal, replace the contents of the location with a new value, and return 1 (true), otherwise return 0 (false).
__sync_val_compare_and_swapAtomically compare a referenced location with a given value. If equal, replace the contents of the location with a new value. Return the resulting value.
__sync_synchronizeA synchronization point.
__sync_lock_test_and_setAtomically set a referenced location to a value and return the old value. Acquire a lock on the referenced location.
__sync_lock_releaseRelease a lock acquired previously.