Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 // This file is an internal atomic implementation, use atomicops.h instead. | 5 // This file is an internal atomic implementation, use atomicops.h instead. |
| 6 // | 6 // |
| 7 // This implementation uses C++11 atomics' member functions. The code base is | 7 // This implementation uses C++11 atomics' member functions. The code base is |
| 8 // currently written assuming atomicity revolves around accesses instead of | 8 // currently written assuming atomicity revolves around accesses instead of |
| 9 // C++11's memory locations. The burden is on the programmer to ensure that all | 9 // C++11's memory locations. The burden is on the programmer to ensure that all |
| 10 // memory locations accessed atomically are never accessed non-atomically (tsan | 10 // memory locations accessed atomically are never accessed non-atomically (tsan |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { | 214 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { |
| 215 return ((AtomicLocation64)ptr)->load(std::memory_order_acquire); | 215 return ((AtomicLocation64)ptr)->load(std::memory_order_acquire); |
| 216 } | 216 } |
| 217 | 217 |
| 218 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { | 218 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
| 219 MemoryBarrier(); | 219 MemoryBarrier(); |
| 220 return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed); | 220 return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed); |
| 221 } | 221 } |
| 222 | 222 |
| 223 #endif // defined(ARCH_CPU_64_BITS) | 223 #endif // defined(ARCH_CPU_64_BITS) |
| 224 } | 224 } // namespace subtle |
| 225 } // namespace base::subtle | 225 } // namespace base |
|
Nico
2015/03/06 22:11:17
totally valid c++17 :-P
| |
| 226 | 226 |
| 227 #endif // BASE_ATOMICOPS_INTERNALS_PORTABLE_H_ | 227 #endif // BASE_ATOMICOPS_INTERNALS_PORTABLE_H_ |
| OLD | NEW |