Reputation: 2610
Interlocked/Atomic operations are CPU specific.
Is there any common baseline requirement by all Android supporting hardware as far as for interlocked operations?
Are there any interlocked operations supported by all Android devices?
Is there any Android equivalent to Windows' InterlockedExchange?
Any help will be appreciated.
Upvotes: 2
Views: 4459
Reputation: 5292
There's stdatomic
header in latest editions of ndk, so if you use GNU or LLVM cxx module, it is possible to use this standard C++11 header. You cannot use it with STLport however - it has no such header. Do not forget to add libatomic to LOCAL_LDLIBS
(see https://developer.android.com/ndk/guides/cpp-support.html for details).
Upvotes: 0
Reputation: 12927
You can use __atomic_swap for InterlockedExchange functionality.
Read docs/ANDROID-ATOMICS.html file from NDK distribution for more info.
Upvotes: 3