OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // Mutex to guarantee serialization of RLZ key accesses. | 5 // Mutex to guarantee serialization of RLZ key accesses. |
6 | 6 |
7 #ifndef RLZ_WIN_LIB_LIB_MUTEX_H_ | 7 #ifndef RLZ_WIN_LIB_LIB_MUTEX_H_ |
8 #define RLZ_WIN_LIB_LIB_MUTEX_H_ | 8 #define RLZ_WIN_LIB_LIB_MUTEX_H_ |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
11 | 11 |
12 namespace rlz_lib { | 12 namespace rlz_lib { |
13 | 13 |
14 class LibMutex { | 14 class LibMutex { |
15 public: | 15 public: |
16 LibMutex(); | 16 LibMutex(); |
17 ~LibMutex(); | 17 ~LibMutex(); |
18 | 18 |
19 bool failed(void) { return !acquired_; } | 19 bool failed(void) { return !acquired_; } |
20 | 20 |
21 private: | 21 private: |
22 bool acquired_; | 22 bool acquired_; |
23 HANDLE mutex_; | 23 HANDLE mutex_; |
24 }; | 24 }; |
25 | 25 |
26 } // namespace rlz_lib | 26 } // namespace rlz_lib |
27 | 27 |
28 #endif // RLZ_WIN_LIB_LIB_MUTEX_H_ | 28 #endif // RLZ_WIN_LIB_LIB_MUTEX_H_ |
OLD | NEW |