Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: include/core/SkAtomics.h

Issue 956013002: fix race to set the new gen ID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkAtomics.h
diff --git a/include/core/SkAtomics.h b/include/core/SkAtomics.h
index d61b47a4fda514e8490614b6504903547de8164c..cdd39ef4b753ffdba6ccc577eb014f2868451dcd 100644
--- a/include/core/SkAtomics.h
+++ b/include/core/SkAtomics.h
@@ -42,6 +42,12 @@ public:
void store(const T& val, sk_memory_order mo = sk_memory_order_seq_cst) {
sk_atomic_store(&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) {
+ return sk_atomic_compare_exchange(&fVal, expected, desired, success, failure);
+ }
private:
T fVal;
};
« no previous file with comments | « no previous file | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698