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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread.h
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index 5ac2a2776b0a302f782d0c2d8b2e6daa1b4ce850..5929ef4503ff1aed8bf3f1fc79373d9323428e02 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -113,8 +113,22 @@ class Monitor {
void Notify();
void NotifyAll();
+#if defined(DEBUG)
+ bool IsOwnedByCurrentThread() const {
+ return owner_ == OSThread::GetCurrentThreadId();
+ }
+#else
+ bool IsOwnedByCurrentThread() const {
+ UNREACHABLE();
+ return false;
+ }
+#endif
+
private:
MonitorData data_; // OS-specific data.
+#if defined(DEBUG)
+ ThreadId owner_;
+#endif // defined(DEBUG)
DISALLOW_COPY_AND_ASSIGN(Monitor);
};
« 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