OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef BIN_LOCKERS_H_ | 5 #ifndef BIN_LOCKERS_H_ |
6 #define BIN_LOCKERS_H_ | 6 #define BIN_LOCKERS_H_ |
7 | 7 |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 | 10 |
11 | |
12 namespace dart { | 11 namespace dart { |
13 namespace bin { | 12 namespace bin { |
14 | 13 |
15 class MutexLocker { | 14 class MutexLocker { |
16 public: | 15 public: |
17 explicit MutexLocker(Mutex* mutex) : mutex_(mutex) { | 16 explicit MutexLocker(Mutex* mutex) : mutex_(mutex) { |
18 ASSERT(mutex != NULL); | 17 ASSERT(mutex != NULL); |
19 mutex_->Lock(); | 18 mutex_->Lock(); |
20 } | 19 } |
21 | 20 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 private: | 55 private: |
57 Monitor* const monitor_; | 56 Monitor* const monitor_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(MonitorLocker); | 58 DISALLOW_COPY_AND_ASSIGN(MonitorLocker); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace bin | 61 } // namespace bin |
63 } // namespace dart | 62 } // namespace dart |
64 | 63 |
65 #endif // BIN_LOCKERS_H_ | 64 #endif // BIN_LOCKERS_H_ |
OLD | NEW |