| OLD | NEW |
| 1 // Copyright (c) 2005, 2006, Google Inc. | 1 // Copyright (c) 2005, 2006, Google Inc. |
| 2 // Copyright (c) 2010, Patrick Gansterer <paroga@paroga.com> | 2 // Copyright (c) 2010, Patrick Gansterer <paroga@paroga.com> |
| 3 // All rights reserved. | 3 // All rights reserved. |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 // --- | 31 // --- |
| 32 // Author: Sanjay Ghemawat <opensource@google.com> | 32 // Author: Sanjay Ghemawat <opensource@google.com> |
| 33 | 33 |
| 34 #ifndef TCMALLOC_INTERNAL_SPINLOCK_H__ | 34 #ifndef TCMALLOC_INTERNAL_SPINLOCK_H__ |
| 35 #define TCMALLOC_INTERNAL_SPINLOCK_H__ | 35 #define TCMALLOC_INTERNAL_SPINLOCK_H__ |
| 36 | 36 |
| 37 #include <wtf/Atomics.h> | 37 #include "wtf/Atomics.h" |
| 38 #if OS(UNIX) | 38 #if OS(UNIX) |
| 39 #include <sched.h> | 39 #include <sched.h> |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #if ENABLE(COMPARE_AND_SWAP) | 42 #if ENABLE(COMPARE_AND_SWAP) |
| 43 | 43 |
| 44 static void TCMalloc_SlowLock(unsigned* lockword); | 44 static void TCMalloc_SlowLock(unsigned* lockword); |
| 45 | 45 |
| 46 // The following is a struct so that it can be initialized at compile time | 46 // The following is a struct so that it can be initialized at compile time |
| 47 struct TCMalloc_SpinLock { | 47 struct TCMalloc_SpinLock { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 inline explicit TCMalloc_SpinLockHolder(TCMalloc_SpinLock* l) | 124 inline explicit TCMalloc_SpinLockHolder(TCMalloc_SpinLock* l) |
| 125 : lock_(l) { l->Lock(); } | 125 : lock_(l) { l->Lock(); } |
| 126 inline ~TCMalloc_SpinLockHolder() { lock_->Unlock(); } | 126 inline ~TCMalloc_SpinLockHolder() { lock_->Unlock(); } |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 // Short-hands for convenient use by tcmalloc.cc | 129 // Short-hands for convenient use by tcmalloc.cc |
| 130 typedef TCMalloc_SpinLock SpinLock; | 130 typedef TCMalloc_SpinLock SpinLock; |
| 131 typedef TCMalloc_SpinLockHolder SpinLockHolder; | 131 typedef TCMalloc_SpinLockHolder SpinLockHolder; |
| 132 | 132 |
| 133 #endif // TCMALLOC_INTERNAL_SPINLOCK_H__ | 133 #endif // TCMALLOC_INTERNAL_SPINLOCK_H__ |
| OLD | NEW |