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

Unified Diff: include/ports/SkAtomics_sync.h

Issue 1348113004: Add subtract to atomics. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « include/ports/SkAtomics_std.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/ports/SkAtomics_sync.h
diff --git a/include/ports/SkAtomics_sync.h b/include/ports/SkAtomics_sync.h
index 7ca0b46a94a6b23f95e60d7d57109cb3325d8167..02b1e580725d9f949ded0b3c6861f07de16fa8dc 100644
--- a/include/ports/SkAtomics_sync.h
+++ b/include/ports/SkAtomics_sync.h
@@ -46,6 +46,11 @@ T sk_atomic_fetch_add(T* ptr, T val, sk_memory_order) {
}
template <typename T>
+T sk_atomic_fetch_sub(T* ptr, T val, sk_memory_order) {
+ return __sync_fetch_and_sub(ptr, val);
+}
+
+template <typename T>
bool sk_atomic_compare_exchange(T* ptr, T* expected, T desired, sk_memory_order, sk_memory_order) {
T prev = __sync_val_compare_and_swap(ptr, *expected, desired);
if (prev == *expected) {
« no previous file with comments | « include/ports/SkAtomics_std.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698