Index: include/core/SkAtomics.h |
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h |
index d31d9c64fb40ce13a20cc7db9a3e485bae0576d0..7c5294b76da582e56414cb2e7ab842d14e48b8fc 100644 |
--- a/include/core/SkAtomics.h |
+++ b/include/core/SkAtomics.h |
@@ -30,6 +30,9 @@ template <typename T> |
T sk_atomic_fetch_add(T*, T, sk_memory_order = sk_memory_order_seq_cst); |
template <typename T> |
+T sk_atomic_fetch_sub(T*, T, sk_memory_order = sk_memory_order_seq_cst); |
+ |
+template <typename T> |
bool sk_atomic_compare_exchange(T*, T* expected, T desired, |
sk_memory_order success = sk_memory_order_seq_cst, |
sk_memory_order failure = sk_memory_order_seq_cst); |
@@ -58,6 +61,10 @@ public: |
return sk_atomic_fetch_add(&fVal, val, mo); |
} |
+ T fetch_sub(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) { |
+ return sk_atomic_fetch_sub(&fVal, val, mo); |
+ } |
+ |
bool compare_exchange(T* expected, const T& desired, |
sk_memory_order success = sk_memory_order_seq_cst, |
sk_memory_order failure = sk_memory_order_seq_cst) { |