#include <cafe/os.h> BOOL OSCompareAndSwapAtomicEx(volatile OSAtomicVar* ptr, u32 cmp_val, u32 new_val, u32 *orig_val);
|ptr||Pointer to data to compare and swap atomically.|
|cmp_val||Value to compare against memory.|
|new_val||Value to swap into memory.|
|orig_val||Returned original atomic value.|
TRUE if cmp_val and value contained at address ptr are equal.
FALSE if cmp_val and value contained at address ptr are not equal.
OSCompareAndSwapAtomicEx performs an atomic swap with a value in memory.
If cmp_val and the value
contained at the address ptr are equal, the value contained
at address ptr is changed to new_val.
This is useful if the value needs to be atomically manipulated by multiple processors.
This version always returns the original atomic value on function entry to variable orig_val.
It does not act as a memory barrier.
2013/05/08 Automated cleanup pass.
2012/07/25 Cleanup Pass
2010/08/30 Initial version.