| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef BASE_SYNCHRONIZATION_SPIN_LOCK_H | 5 #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H |
| 6 #define BASE_SYNCHRONIZATION_SPIN_LOCK_H | 6 #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H |
| 7 | 7 |
| 8 #include <atomic> | 8 #include <atomic> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <mutex> | 10 #include <mutex> |
| 11 | 11 |
| 12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 | 14 |
| 15 // Spinlock is a simple spinlock class based on the standard CPU primitive of | 15 // Spinlock is a simple spinlock class based on the standard CPU primitive of |
| 16 // atomic increment and decrement of an int at a given memory address. These are | 16 // atomic increment and decrement of an int at a given memory address. These are |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 // This is called if the initial attempt to acquire the lock fails. It's | 42 // This is called if the initial attempt to acquire the lock fails. It's |
| 43 // slower, but has a much better scheduling and power consumption behavior. | 43 // slower, but has a much better scheduling and power consumption behavior. |
| 44 BASE_EXPORT void LockSlow(); | 44 BASE_EXPORT void LockSlow(); |
| 45 | 45 |
| 46 std::atomic_int lock_; | 46 std::atomic_int lock_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace subtle | 49 } // namespace subtle |
| 50 } // namespace base | 50 } // namespace base |
| 51 | 51 |
| 52 #endif // BASE_SYNCHRONIZATION_SPIN_LOCK_H | 52 #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SPIN_LOCK_H |
| OLD | NEW |