OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LOCK_IMPL_H_ | 5 #ifndef BASE_SYNCHRONIZATION_LOCK_IMPL_H_ |
6 #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_ | 6 #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // held by something else, immediately return false. | 38 // held by something else, immediately return false. |
39 bool Try(); | 39 bool Try(); |
40 | 40 |
41 // Take the lock, blocking until it is available if necessary. | 41 // Take the lock, blocking until it is available if necessary. |
42 void Lock(); | 42 void Lock(); |
43 | 43 |
44 // Release the lock. This must only be called by the lock's holder: after | 44 // Release the lock. This must only be called by the lock's holder: after |
45 // a successful call to Try, or a call to Lock. | 45 // a successful call to Try, or a call to Lock. |
46 void Unlock(); | 46 void Unlock(); |
47 | 47 |
48 // Return the native underlying lock. Not supported for Windows builds. | 48 // Return the native underlying lock. |
49 // TODO(awalker): refactor lock and condition variables so that this is | 49 // TODO(awalker): refactor lock and condition variables so that this is |
50 // unnecessary. | 50 // unnecessary. |
51 #if !defined(OS_WIN) | |
52 OSLockType* os_lock() { return &os_lock_; } | 51 OSLockType* os_lock() { return &os_lock_; } |
53 #endif | |
54 | 52 |
55 private: | 53 private: |
56 OSLockType os_lock_; | 54 OSLockType os_lock_; |
57 | 55 |
58 DISALLOW_COPY_AND_ASSIGN(LockImpl); | 56 DISALLOW_COPY_AND_ASSIGN(LockImpl); |
59 }; | 57 }; |
60 | 58 |
61 } // namespace internal | 59 } // namespace internal |
62 } // namespace base | 60 } // namespace base |
63 | 61 |
64 #endif // BASE_SYNCHRONIZATION_LOCK_IMPL_H_ | 62 #endif // BASE_SYNCHRONIZATION_LOCK_IMPL_H_ |
OLD | NEW |