OSGetAtomic64

Syntax

#include <cafe/os.h>

u64 OSGetAtomic64(volatile OSAtomicVar64* ptr);

Parameters

ptr Pointer to data to obtain atomically.

Return Values

Current value.

Description

OSGetAtomic64 gets a 64-bit atomic value in memory. This function is an addition for the 64-bit atomics, to protect against accessing the two 32-bit values in the middle of an update. You should use this function to obtain the atomic value instead of direct access.

It does not act as a memory barrier.

The 64-bit atomics use a lock to protect the multi-word atomic value (CPU is 32-bit).

CAUTION:
These 64-bit atomics are not as high-performance as the 32-bit versions; on average they are about 5 times slower than the 32-bit versions. When using 32-bit atomics, the values can be read and written directly without requiring a function. For more information, see Synchronization and Atomics in the Espresso CPU Performance Guide.

Do Not Call From

None.

See Also

OSAddAtomic64
OSAndAtomic64
OSCompareAndSwapAtomic64
OSCompareAndSwapAtomicEx64
OSDecAtomic64
OSIncAtomic64
OSOrAtomic64
OSSetAtomic64
OSSwapAtomic64
OSTestAndClearAtomic64
OSTestAndSetAtomic64
OSXorAtomic64

Revision History

2013/05/08 Automated cleanup pass.
2010/08/30 Initial version.


CONFIDENTIAL