c++ - Atomic increment on mac OS X -
I have googled for atomic increments and decrease operators on Mac OS X and found "OSAtomic.h" but it seems That you can use it only in the kernel space.
told me on a cross-platform, in which they use assembly or mutes on OS X (as far as I am among the ifdefs).
Is there nothing like atomic_dec ()
on OS X?
Do you think OSAtmic is the only kernel space? The following compile and works fine.
#include & lt; Libkern / OSAtomic.h> # Include & lt; Stdio.h & gt; Int main (int argc, char ** argv) {int32_t foo = 1; OSAtomicDecrement32 (& amp; foo); Printf ("% d \ n", foo); Return 0; }
Comments
Post a Comment