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

Unified Diff: runtime/vm/thread_win.cc

Issue 474913004: - Account for number of pending tasks in old-space collections. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
« runtime/vm/thread_android.cc ('K') | « runtime/vm/thread_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_win.cc
===================================================================
--- runtime/vm/thread_win.cc (revision 39381)
+++ runtime/vm/thread_win.cc (working copy)
@@ -10,6 +10,7 @@
#include <process.h> // NOLINT
#include "platform/assert.h"
+#include "vm/isolate.h"
namespace dart {
@@ -170,11 +171,19 @@
if (data_.semaphore_ == NULL) {
FATAL1("Mutex allocation failed %d", GetLastError());
}
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = NULL;
+#endif // defined(DEBUG)
}
Mutex::~Mutex() {
CloseHandle(data_.semaphore_);
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == NULL);
+#endif // defined(DEBUG)
}
@@ -183,6 +192,10 @@
if (result != WAIT_OBJECT_0) {
FATAL1("Mutex lock failed %d", GetLastError());
}
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
}
@@ -190,6 +203,10 @@
// Attempt to pass the semaphore but return immediately.
DWORD result = WaitForSingleObject(data_.semaphore_, 0);
if (result == WAIT_OBJECT_0) {
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
return true;
}
if (result == WAIT_ABANDONED || result == WAIT_FAILED) {
@@ -201,6 +218,11 @@
void Mutex::Unlock() {
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == Isolate::Current());
+ owner_ = NULL;
+#endif // defined(DEBUG)
BOOL result = ReleaseSemaphore(data_.semaphore_, 1, NULL);
if (result == 0) {
FATAL1("Mutex unlock failed %d", GetLastError());
« runtime/vm/thread_android.cc ('K') | « runtime/vm/thread_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698