Important: The information in this document is obsolete and should not be used for new development.
OTAtomicAdd32
Atomically adds a 32-bit value to a memory location.C INTERFACE
SInt32 OTAtomicAdd32(SInt32 toAdd, SInt32* where)C++ INTERFACE
None. C++ applications use the C interface to this function.PARAMETERS
toAdd- A signed 32-bit value to add to the value referenced by the where
parameter.where- A pointer to a signed 32-bit value that is added to the value specified by the parameter
toAdd.- function result
- The sum of the values specified by the function's parameters.
DISCUSSION
This function atomically adds the signed 32-bit value specified by the parametertoAddto the value referenced by thewhereparameter and returns the result. It also stores the result in the location referenced by thewhereparameter.You can use this function to subtract from the
toAddvalue referenced by thewhereparameter by reversing the sign oftoAdd.
Use the
- WARNING
- The pointer
wheremust be on a 4-byte boundary, or calling this function may hang the machine.![]()
OTAtomicAdd16function to add two 16-bit values.Use the
OTAtomicAdd8function to add two 8-bit values.