I need some function to atomically get int value. Something called OSAtomicGet(). Analog of g_atomic_int_get().
+2
A:
Dereferencing an int
from a known pointer is always atomic on architectures running Mac/iStuffs. Use OSMemoryBarrier() if you need a memory barrier.
int OSAtomicGet(volatile int* value) {
OSMemoryBarrier();
return *value;
}
KennyTM
2010-07-07 16:31:09
Thank you very much!
iUm
2010-07-07 16:41:40