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); |
}; |