Index: include/ports/SkAtomics_atomic.h |
diff --git a/include/ports/SkAtomics_atomic.h b/include/ports/SkAtomics_atomic.h |
index 6ae78a89a97702925597a6be4e9049088a009e6d..ddbf7c3f372124be0881cc4c49308fc5b7f50ad3 100644 |
--- a/include/ports/SkAtomics_atomic.h |
+++ b/include/ports/SkAtomics_atomic.h |
@@ -1,3 +1,10 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
#ifndef SkAtomics_atomic_DEFINED |
#define SkAtomics_atomic_DEFINED |
@@ -37,4 +44,10 @@ bool sk_atomic_compare_exchange(T* ptr, T* expected, T desired, |
return __atomic_compare_exchange_n(ptr, expected, desired, false/*weak?*/, success, failure); |
} |
+template <typename T> |
+T sk_atomic_exchange(T* ptr, T val, sk_memory_order mo) { |
+ // All values of mo are valid. |
+ return __atomic_exchange_n(ptr, val, mo); |
+} |
+ |
#endif//SkAtomics_atomic_DEFINED |