OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_ | |
6 #define RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_ | |
7 | |
8 #include "base/atomicops.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/synchronization/lock.h" | |
11 | |
12 namespace rlz_lib { | |
13 | |
14 | |
15 class RecursiveLock { | |
16 public: | |
17 RecursiveLock(); | |
18 ~RecursiveLock(); | |
19 | |
20 void Acquire(); | |
21 void Release(); | |
22 | |
23 private: | |
24 // Underlying non-recursive lock. | |
25 base::Lock lock_; | |
26 // Owner thread ID. | |
27 base::subtle::Atomic32 owner_; | |
28 // Recursion lock depth. | |
29 int recursion_; | |
30 }; | |
31 | |
32 } // namespace rlz_lib | |
33 | |
34 #endif // RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_ | |
OLD | NEW |