| 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 10 matching lines...) Expand all Loading... |
| 21 // versions are provided when no barriers are needed: | 21 // versions are provided when no barriers are needed: |
| 22 // NoBarrier_Store() | 22 // NoBarrier_Store() |
| 23 // NoBarrier_Load() | 23 // NoBarrier_Load() |
| 24 // Although there are currently no compiler enforcement, you are encouraged | 24 // Although there are currently no compiler enforcement, you are encouraged |
| 25 // to use these. | 25 // to use these. |
| 26 // | 26 // |
| 27 | 27 |
| 28 #ifndef BASE_ATOMICOPS_H_ | 28 #ifndef BASE_ATOMICOPS_H_ |
| 29 #define BASE_ATOMICOPS_H_ | 29 #define BASE_ATOMICOPS_H_ |
| 30 | 30 |
| 31 #include <cassert> // Small C++ header which defines implementation specific | |
| 32 // macros used to identify the STL implementation. | |
| 33 #include <stdint.h> | 31 #include <stdint.h> |
| 34 | 32 |
| 33 // Small C++ header which defines implementation specific macros used to |
| 34 // identify the STL implementation. |
| 35 // - libc++: captures __config for _LIBCPP_VERSION |
| 36 // - libstdc++: captures bits/c++config.h for __GLIBCXX__ |
| 37 #include <cstddef> |
| 38 |
| 35 #include "base/base_export.h" | 39 #include "base/base_export.h" |
| 36 #include "build/build_config.h" | 40 #include "build/build_config.h" |
| 37 | 41 |
| 38 #if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) | 42 #if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) |
| 39 // windows.h #defines this (only on x64). This causes problems because the | 43 // windows.h #defines this (only on x64). This causes problems because the |
| 40 // public API also uses MemoryBarrier at the public name for this fence. So, on | 44 // public API also uses MemoryBarrier at the public name for this fence. So, on |
| 41 // X64, undef it, and call its documented | 45 // X64, undef it, and call its documented |
| 42 // (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) | 46 // (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) |
| 43 // implementation directly. | 47 // implementation directly. |
| 44 #undef MemoryBarrier | 48 #undef MemoryBarrier |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 # endif | 204 # endif |
| 201 #endif // Portable / non-portable includes. | 205 #endif // Portable / non-portable includes. |
| 202 | 206 |
| 203 // On some platforms we need additional declarations to make | 207 // On some platforms we need additional declarations to make |
| 204 // AtomicWord compatible with our other Atomic* types. | 208 // AtomicWord compatible with our other Atomic* types. |
| 205 #if defined(OS_MACOSX) || defined(OS_OPENBSD) | 209 #if defined(OS_MACOSX) || defined(OS_OPENBSD) |
| 206 #include "base/atomicops_internals_atomicword_compat.h" | 210 #include "base/atomicops_internals_atomicword_compat.h" |
| 207 #endif | 211 #endif |
| 208 | 212 |
| 209 #endif // BASE_ATOMICOPS_H_ | 213 #endif // BASE_ATOMICOPS_H_ |
| OLD | NEW |