Index: include/ports/SkAtomics_atomic.h |
diff --git a/include/ports/SkAtomics_atomic.h b/include/ports/SkAtomics_atomic.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3ae328a153fca91049fcdf18d11ff76d6c93f998 |
--- /dev/null |
+++ b/include/ports/SkAtomics_atomic.h |
@@ -0,0 +1,26 @@ |
+#ifndef SkAtomics_atomic_DEFINED |
+#define SkAtomics_atomic_DEFINED |
+ |
+template <typename T> |
+T sk_atomic_load(const T* ptr, sk_memory_order mo) { |
+ return __atomic_load_n(ptr, mo); |
+} |
+ |
+template <typename T> |
+void sk_atomic_store(T* ptr, T val, sk_memory_order mo) { |
+ __atomic_store_n(ptr, val, mo); |
+} |
+ |
+template <typename T> |
+T sk_atomic_fetch_add(T* ptr, T val, sk_memory_order mo) { |
+ return __atomic_fetch_add(ptr, val, mo); |
+} |
+ |
+template <typename T> |
+bool sk_atomic_compare_exchange(T* ptr, T* expected, T desired, |
+ sk_memory_order success, |
+ sk_memory_order failure) { |
+ return __atomic_compare_exchange_n(ptr, expected, desired, false/*weak?*/, success, failure); |
+} |
+ |
+#endif//SkAtomics_atomic_DEFINED |