OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 #undef MemoryBarrier | 40 #undef MemoryBarrier |
41 #endif | 41 #endif |
42 | 42 |
43 namespace base { | 43 namespace base { |
44 namespace subtle { | 44 namespace subtle { |
45 | 45 |
46 typedef int32 Atomic32; | 46 typedef int32 Atomic32; |
47 #ifdef ARCH_CPU_64_BITS | 47 #ifdef ARCH_CPU_64_BITS |
48 // We need to be able to go between Atomic64 and AtomicWord implicitly. This | 48 // We need to be able to go between Atomic64 and AtomicWord implicitly. This |
49 // means Atomic64 and AtomicWord should be the same type on 64-bit. | 49 // means Atomic64 and AtomicWord should be the same type on 64-bit. |
50 #if defined(OS_NACL) | 50 #if defined(__ILP32__) || defined(OS_NACL) |
51 // NaCl's intptr_t is not actually 64-bits on 64-bit! | 51 // NaCl's intptr_t is not actually 64-bits on 64-bit! |
52 // http://code.google.com/p/nativeclient/issues/detail?id=1162 | 52 // http://code.google.com/p/nativeclient/issues/detail?id=1162 |
53 typedef int64_t Atomic64; | 53 typedef int64_t Atomic64; |
54 #else | 54 #else |
55 typedef intptr_t Atomic64; | 55 typedef intptr_t Atomic64; |
56 #endif | 56 #endif |
57 #endif | 57 #endif |
58 | 58 |
59 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or | 59 // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or |
60 // Atomic64 routines below, depending on your architecture. | 60 // Atomic64 routines below, depending on your architecture. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #error "Atomic operations are not supported on your platform" | 154 #error "Atomic operations are not supported on your platform" |
155 #endif | 155 #endif |
156 | 156 |
157 // On some platforms we need additional declarations to make | 157 // On some platforms we need additional declarations to make |
158 // AtomicWord compatible with our other Atomic* types. | 158 // AtomicWord compatible with our other Atomic* types. |
159 #if defined(OS_MACOSX) || defined(OS_OPENBSD) | 159 #if defined(OS_MACOSX) || defined(OS_OPENBSD) |
160 #include "base/atomicops_internals_atomicword_compat.h" | 160 #include "base/atomicops_internals_atomicword_compat.h" |
161 #endif | 161 #endif |
162 | 162 |
163 #endif // BASE_ATOMICOPS_H_ | 163 #endif // BASE_ATOMICOPS_H_ |
OLD | NEW |