diff options
author | herb <herb@google.com> | 2015-09-15 07:03:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-15 07:03:03 -0700 |
commit | 014ffdb01ea5317614a1569efc30c50f06434222 (patch) | |
tree | 3ddd6142fe30a488a982bc7b72406c7a835cf366 /include/core | |
parent | 474df7fc03e58b85ef256cc314aa439316fcd38d (diff) |
Parallel cache.
TBR=reed@google.com
BUG=skia:1330,528560
Committed: https://skia.googlesource.com/skia/+/6f2a486040cb25465990196c229feb47e668e87f
Committed: https://skia.googlesource.com/skia/+/bf2988833e5a36c6b430da6fdd2cfebd0015adec
Review URL: https://codereview.chromium.org/1264103003
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkAtomics.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h index d31d9c64fb..7c5294b76d 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) { |