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

Unified Diff: runtime/vm/os_thread_win.cc

Issue 1748953003: - Add assertions in MutexLocker/MonitorLocker to ensure that the code enclosed (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 10 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 | « runtime/vm/os_thread_macos.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
« no previous file with comments | « runtime/vm/os_thread_macos.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698