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 InterlockedDecrement or 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

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -