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

Unified Diff: source/common/umutex.h

Issue 1225213014: go back to ps #4 Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: Created 5 years, 5 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 | « source/common/putilimp.h ('k') | source/common/umutex.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/umutex.h
diff --git a/source/common/umutex.h b/source/common/umutex.h
index e0ad0d3c03654d61a023a082548563d8d4c03c61..0e4d118523c874f34098d4038c2167ced663fd8e 100644
--- a/source/common/umutex.h
+++ b/source/common/umutex.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1997-2014, International Business Machines
+* Copyright (C) 1997-2015, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -118,6 +118,33 @@ inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
U_NAMESPACE_END
+#elif U_HAVE_CLANG_ATOMICS
+/*
+ * Clang __c11 atomic built-ins
+ */
+
+U_NAMESPACE_BEGIN
+typedef _Atomic(int32_t) u_atomic_int32_t;
+#define ATOMIC_INT32_T_INITIALIZER(val) val
+
+inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
+ return __c11_atomic_load(&var, __ATOMIC_ACQUIRE);
+}
+
+inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
+ return __c11_atomic_store(&var, val, __ATOMIC_RELEASE);
+}
+
+inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
+ return __c11_atomic_fetch_add(var, 1, __ATOMIC_SEQ_CST) + 1;
+}
+
+inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
+ return __c11_atomic_fetch_sub(var, 1, __ATOMIC_SEQ_CST) - 1;
+}
+U_NAMESPACE_END
+
+
#elif U_HAVE_GCC_ATOMICS
/*
* gcc atomic ops. These are available on several other compilers as well.
« no previous file with comments | « source/common/putilimp.h ('k') | source/common/umutex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698