OLD | NEW |
---|---|
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_LOCK_H_ | 5 #ifndef BASE_LOCK_H_ |
6 #define BASE_LOCK_H_ | 6 #define BASE_LOCK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/lock_impl.h" | 9 #include "base/lock_impl.h" |
10 #if !defined(NDEBUG) | |
11 #include "base/platform_thread.h" | |
jar (doing other things)
2010/11/19 01:45:14
IMO, using conditional inclusion depending on debu
Lei Zhang
2010/11/19 19:06:16
I can definitely see this causing release vs. debu
| |
12 #endif | |
10 | 13 |
11 // A convenient wrapper for an OS specific critical section. The only real | 14 // A convenient wrapper for an OS specific critical section. The only real |
12 // intelligence in this class is in debug mode for the support for the | 15 // intelligence in this class is in debug mode for the support for the |
13 // AssertAcquired() method. | 16 // AssertAcquired() method. |
14 | 17 |
15 class Lock { | 18 class Lock { |
16 public: | 19 public: |
17 #if defined(NDEBUG) // Optimized wrapper implementation | 20 #if defined(NDEBUG) // Optimized wrapper implementation |
18 Lock() : lock_() {} | 21 Lock() : lock_() {} |
19 ~Lock() {} | 22 ~Lock() {} |
(...skipping 97 matching lines...) Loading... | |
117 ~AutoUnlock() { | 120 ~AutoUnlock() { |
118 lock_.Acquire(); | 121 lock_.Acquire(); |
119 } | 122 } |
120 | 123 |
121 private: | 124 private: |
122 Lock& lock_; | 125 Lock& lock_; |
123 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); | 126 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); |
124 }; | 127 }; |
125 | 128 |
126 #endif // BASE_LOCK_H_ | 129 #endif // BASE_LOCK_H_ |
OLD | NEW |