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

Side by Side Diff: base/atomicops.h

Issue 1466833002: C++11 atomics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep compat.h for now. Created 5 years 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 | « base/BUILD.gn ('k') | base/atomicops_internals_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // For atomic operations on reference counts, see atomic_refcount.h. 5 // For atomic operations on reference counts, see atomic_refcount.h.
6 // For atomic operations on sequence numbers, see atomic_sequence_num.h. 6 // For atomic operations on sequence numbers, see atomic_sequence_num.h.
7 7
8 // The routines exported by this module are subtle. If you use them, even if 8 // The routines exported by this module are subtle. If you use them, even if
9 // you get the code right, it will depend on careful reasoning about atomicity 9 // you get the code right, it will depend on careful reasoning about atomicity
10 // and memory ordering; it will be less readable, and harder to maintain. If 10 // and memory ordering; it will be less readable, and harder to maintain. If
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); 137 void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
138 void Release_Store(volatile Atomic64* ptr, Atomic64 value); 138 void Release_Store(volatile Atomic64* ptr, Atomic64 value);
139 Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); 139 Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
140 Atomic64 Acquire_Load(volatile const Atomic64* ptr); 140 Atomic64 Acquire_Load(volatile const Atomic64* ptr);
141 Atomic64 Release_Load(volatile const Atomic64* ptr); 141 Atomic64 Release_Load(volatile const Atomic64* ptr);
142 #endif // ARCH_CPU_64_BITS 142 #endif // ARCH_CPU_64_BITS
143 143
144 } // namespace subtle 144 } // namespace subtle
145 } // namespace base 145 } // namespace base
146 146
147 // Try to use a portable implementation based on C++11 atomics. 147 #if (defined(OS_WIN) && defined(COMPILER_MSVC) && \
Nico 2015/12/07 03:55:58 OS_WIN implies COMPILER_MSVC, remove the COMPILER_
JF 2015/12/07 04:23:31 That's true when using LLVM on Windows as well? I'
Nico 2015/12/07 04:58:28 Yes. Just like clang defines__gnuc__ when using th
148 // 148 defined(ARCH_CPU_X86_FAMILY))
Nico 2015/12/07 03:55:58 We don't have a win/arm build either, so you can g
JF 2015/12/07 04:23:31 Removed, you're right it shouldn't have been there
149 // Some toolchains support C++11 language features without supporting library 149 // TODO(jfb): The MSVC header includes windows.h, which other files end up
150 // features (recent compiler, older STL). Whitelist libstdc++ and libc++ that we 150 // relying on. Fix this as part of crbug.com/559247.
151 // know will have <atomic> when compiling C++11. 151 # include "base/atomicops_internals_x86_msvc.h"
152 #if ((__cplusplus >= 201103L) && \ 152 #else
153 ((defined(__GLIBCXX__) && (__GLIBCXX__ > 20110216)) || \
154 (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER >= 11))))
155 # include "base/atomicops_internals_portable.h" 153 # include "base/atomicops_internals_portable.h"
156 #else // Otherwise use a platform specific implementation. 154 #endif
157 # if defined(THREAD_SANITIZER)
158 # error "Thread sanitizer must use the portable atomic operations"
159 # elif (defined(OS_WIN) && defined(COMPILER_MSVC) && \
160 defined(ARCH_CPU_X86_FAMILY))
161 # include "base/atomicops_internals_x86_msvc.h"
162 # elif defined(OS_MACOSX)
163 # include "base/atomicops_internals_mac.h"
164 # else
165 # error "Atomic operations are not supported on your platform"
166 # endif
167 #endif // Portable / non-portable includes.
168 155
169 // On some platforms we need additional declarations to make 156 // On some platforms we need additional declarations to make
170 // AtomicWord compatible with our other Atomic* types. 157 // AtomicWord compatible with our other Atomic* types.
171 #if defined(OS_MACOSX) || defined(OS_OPENBSD) 158 #if defined(OS_MACOSX) || defined(OS_OPENBSD)
172 #include "base/atomicops_internals_atomicword_compat.h" 159 #include "base/atomicops_internals_atomicword_compat.h"
173 #endif 160 #endif
174 161
175 #endif // BASE_ATOMICOPS_H_ 162 #endif // BASE_ATOMICOPS_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/atomicops_internals_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698