OSSetAtomic64

Syntax

#include <cafe/os.h>

u64 OSSetAtomic64(volatile OSAtomicVar64* ptr, u64 val);

Parameters

ptr Pointer to data to set atomically.
val Value to set atomically to the value in memory.

Return Values

Previous value.

Description

OSSetAtomic64 sets an 64-bit atomic value to 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 set 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
OSGetAtomic64
OSIncAtomic64
OSOrAtomic64
OSSwapAtomic64
OSTestAndClearAtomic64
OSTestAndSetAtomic64
OSXorAtomic64

Revision History

2013/05/08 Automated cleanup pass.
2012/05/14 Match actual prototype
2010/08/30 Initial version.


CONFIDENTIAL