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

Side by Side Diff: runtime/vm/os_thread.h

Issue 1426743002: Add lock owner information for class Monitor and add assertions for wait/notify/notifyall. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years, 1 month 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
« no previous file with comments | « no previous file | runtime/vm/os_thread_android.cc » ('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 VM_OS_THREAD_H_ 5 #ifndef VM_OS_THREAD_H_
6 #define VM_OS_THREAD_H_ 6 #define VM_OS_THREAD_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void Exit(); 106 void Exit();
107 107
108 // Wait for notification or timeout. 108 // Wait for notification or timeout.
109 WaitResult Wait(int64_t millis); 109 WaitResult Wait(int64_t millis);
110 WaitResult WaitMicros(int64_t micros); 110 WaitResult WaitMicros(int64_t micros);
111 111
112 // Notify waiting threads. 112 // Notify waiting threads.
113 void Notify(); 113 void Notify();
114 void NotifyAll(); 114 void NotifyAll();
115 115
116 #if defined(DEBUG)
117 bool IsOwnedByCurrentThread() const {
118 return owner_ == OSThread::GetCurrentThreadId();
119 }
120 #else
121 bool IsOwnedByCurrentThread() const {
122 UNREACHABLE();
123 return false;
124 }
125 #endif
126
116 private: 127 private:
117 MonitorData data_; // OS-specific data. 128 MonitorData data_; // OS-specific data.
129 #if defined(DEBUG)
130 ThreadId owner_;
131 #endif // defined(DEBUG)
118 132
119 DISALLOW_COPY_AND_ASSIGN(Monitor); 133 DISALLOW_COPY_AND_ASSIGN(Monitor);
120 }; 134 };
121 135
122 136
123 } // namespace dart 137 } // namespace dart
124 138
125 139
126 #endif // VM_OS_THREAD_H_ 140 #endif // VM_OS_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698