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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « source/common/putilimp.h ('k') | source/common/umutex.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (C) 1997-2014, International Business Machines 3 * Copyright (C) 1997-2015, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * 6 *
7 * File UMUTEX.H 7 * File UMUTEX.H
8 * 8 *
9 * Modification History: 9 * Modification History:
10 * 10 *
11 * Date Name Description 11 * Date Name Description
12 * 04/02/97 aliu Creation. 12 * 04/02/97 aliu Creation.
13 * 04/07/99 srl rewrite - C interface, multiple mutices 13 * 04/07/99 srl rewrite - C interface, multiple mutices
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) { 111 inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
112 return InterlockedIncrement(var); 112 return InterlockedIncrement(var);
113 } 113 }
114 114
115 inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) { 115 inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
116 return InterlockedDecrement(var); 116 return InterlockedDecrement(var);
117 } 117 }
118 U_NAMESPACE_END 118 U_NAMESPACE_END
119 119
120 120
121 #elif U_HAVE_CLANG_ATOMICS
122 /*
123 * Clang __c11 atomic built-ins
124 */
125
126 U_NAMESPACE_BEGIN
127 typedef _Atomic(int32_t) u_atomic_int32_t;
128 #define ATOMIC_INT32_T_INITIALIZER(val) val
129
130 inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
131 return __c11_atomic_load(&var, __ATOMIC_ACQUIRE);
132 }
133
134 inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
135 return __c11_atomic_store(&var, val, __ATOMIC_RELEASE);
136 }
137
138 inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
139 return __c11_atomic_fetch_add(var, 1, __ATOMIC_SEQ_CST) + 1;
140 }
141
142 inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
143 return __c11_atomic_fetch_sub(var, 1, __ATOMIC_SEQ_CST) - 1;
144 }
145 U_NAMESPACE_END
146
147
121 #elif U_HAVE_GCC_ATOMICS 148 #elif U_HAVE_GCC_ATOMICS
122 /* 149 /*
123 * gcc atomic ops. These are available on several other compilers as well. 150 * gcc atomic ops. These are available on several other compilers as well.
124 */ 151 */
125 152
126 U_NAMESPACE_BEGIN 153 U_NAMESPACE_BEGIN
127 typedef int32_t u_atomic_int32_t; 154 typedef int32_t u_atomic_int32_t;
128 #define ATOMIC_INT32_T_INITIALIZER(val) val 155 #define ATOMIC_INT32_T_INITIALIZER(val) val
129 156
130 inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) { 157 inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond); 442 U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond);
416 443
417 /* 444 /*
418 * Signal a condition variable, waking up one waiting thread. 445 * Signal a condition variable, waking up one waiting thread.
419 * CAUTION: Do not use. Place holder only. Not implemented for Windows. 446 * CAUTION: Do not use. Place holder only. Not implemented for Windows.
420 */ 447 */
421 U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond); 448 U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond);
422 449
423 #endif /* UMUTEX_H */ 450 #endif /* UMUTEX_H */
424 /*eof*/ 451 /*eof*/
OLDNEW
« 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