Index: include/ports/SkAtomics_std.h |
diff --git a/include/ports/SkAtomics_std.h b/include/ports/SkAtomics_std.h |
index 4c26858dfda4b0b22be881b3be7b37b05a9e2d26..163efb78c0c1019942986ea4c3eaca8d5a049bb5 100644 |
--- a/include/ports/SkAtomics_std.h |
+++ b/include/ports/SkAtomics_std.h |
@@ -39,6 +39,13 @@ T sk_atomic_fetch_add(T* ptr, T val, sk_memory_order mo) { |
} |
template <typename T> |
+T sk_atomic_fetch_sub(T* ptr, T val, sk_memory_order mo) { |
+ // All values of mo are valid. |
+ std::atomic<T>* ap = reinterpret_cast<std::atomic<T>*>(ptr); |
+ return std::atomic_fetch_sub_explicit(ap, val, (std::memory_order)mo); |
+} |
+ |
+template <typename T> |
bool sk_atomic_compare_exchange(T* ptr, T* expected, T desired, |
sk_memory_order success, |
sk_memory_order failure) { |