Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: runtime/bin/lockers.h

Issue 471743002: - Make sure that the threads for dart::bin are in the correct namespace. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/eventhandler_win.cc ('k') | runtime/bin/process.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11
12 namespace dart { 12 namespace dart {
13 namespace bin { 13 namespace bin {
14 14
15 class MutexLocker { 15 class MutexLocker {
16 public: 16 public:
17 explicit MutexLocker(dart::Mutex* mutex) : mutex_(mutex) { 17 explicit MutexLocker(Mutex* mutex) : mutex_(mutex) {
18 ASSERT(mutex != NULL); 18 ASSERT(mutex != NULL);
19 mutex_->Lock(); 19 mutex_->Lock();
20 } 20 }
21 21
22 virtual ~MutexLocker() { 22 virtual ~MutexLocker() {
23 mutex_->Unlock(); 23 mutex_->Unlock();
24 } 24 }
25 25
26 private: 26 private:
27 dart::Mutex* const mutex_; 27 Mutex* const mutex_;
28 28
29 DISALLOW_COPY_AND_ASSIGN(MutexLocker); 29 DISALLOW_COPY_AND_ASSIGN(MutexLocker);
30 }; 30 };
31 31
32 32
33 class MonitorLocker { 33 class MonitorLocker {
34 public: 34 public:
35 explicit MonitorLocker(dart::Monitor* monitor) : monitor_(monitor) { 35 explicit MonitorLocker(Monitor* monitor) : monitor_(monitor) {
36 ASSERT(monitor != NULL); 36 ASSERT(monitor != NULL);
37 monitor_->Enter(); 37 monitor_->Enter();
38 } 38 }
39 39
40 virtual ~MonitorLocker() { 40 virtual ~MonitorLocker() {
41 monitor_->Exit(); 41 monitor_->Exit();
42 } 42 }
43 43
44 dart::Monitor::WaitResult Wait(int64_t millis = dart::Monitor::kNoTimeout) { 44 Monitor::WaitResult Wait(int64_t millis = Monitor::kNoTimeout) {
45 return monitor_->Wait(millis); 45 return monitor_->Wait(millis);
46 } 46 }
47 47
48 void Notify() { 48 void Notify() {
49 monitor_->Notify(); 49 monitor_->Notify();
50 } 50 }
51 51
52 void NotifyAll() { 52 void NotifyAll() {
53 monitor_->NotifyAll(); 53 monitor_->NotifyAll();
54 } 54 }
55 55
56 private: 56 private:
57 dart::Monitor* const monitor_; 57 Monitor* const monitor_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(MonitorLocker); 59 DISALLOW_COPY_AND_ASSIGN(MonitorLocker);
60 }; 60 };
61 61
62 } // namespace bin 62 } // namespace bin
63 } // namespace dart 63 } // namespace dart
64 64
65 #endif // BIN_LOCKERS_H_ 65 #endif // BIN_LOCKERS_H_
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_win.cc ('k') | runtime/bin/process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698