Index: runtime/vm/os_thread_win.cc |
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc |
index 7a29d0da46c27fe457788279a3651f183cd87fb4..ccab0841b3d120ab9fb36611838b76ab042a5073 100644 |
--- a/runtime/vm/os_thread_win.cc |
+++ b/runtime/vm/os_thread_win.cc |
@@ -305,6 +305,21 @@ Monitor::~Monitor() { |
} |
+bool Mutex::TryEnter() { |
+ // Attempt to pass the semaphore but return immediately. |
+ BOOL result = TryEnterCriticalSection(&data_.cs_); |
+ if (!result) { |
+ return false; |
+ } |
+#if defined(DEBUG) |
+ // When running with assertions enabled we do track the owner. |
+ ASSERT(owner_ == OSThread::kInvalidThreadId); |
+ owner_ = OSThread::GetCurrentThreadId(); |
+#endif // defined(DEBUG) |
+ return true; |
+} |
+ |
+ |
void Monitor::Enter() { |
EnterCriticalSection(&data_.cs_); |