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

Unified Diff: runtime/vm/thread_linux.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
Index: runtime/vm/thread_linux.cc
===================================================================
--- runtime/vm/thread_linux.cc (revision 39381)
+++ runtime/vm/thread_linux.cc (working copy)
@@ -12,6 +12,7 @@
#include <sys/time.h> // NOLINT
#include "platform/assert.h"
+#include "vm/isolate.h"
namespace dart {
@@ -193,6 +194,11 @@
result = pthread_mutexattr_destroy(&attr);
VALIDATE_PTHREAD_RESULT(result);
+
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = NULL;
+#endif // defined(DEBUG)
}
@@ -200,6 +206,11 @@
int result = pthread_mutex_destroy(data_.mutex());
// Verify that the pthread_mutex was destroyed.
VALIDATE_PTHREAD_RESULT(result);
+
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == NULL);
+#endif // defined(DEBUG)
}
@@ -208,7 +219,10 @@
// Specifically check for dead lock to help debugging.
ASSERT(result != EDEADLK);
ASSERT(result == 0); // Verify no other errors.
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
}
@@ -219,13 +233,20 @@
return false;
}
ASSERT(result == 0); // Verify no other errors.
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ owner_ = Isolate::Current();
+#endif // defined(DEBUG)
return true;
}
void Mutex::Unlock() {
- // TODO(iposva): Do we need to track lock owners?
+ // When running with assertions enabled we do track the owner.
+#if defined(DEBUG)
+ ASSERT(owner_ == Isolate::Current());
+ owner_ = NULL;
+#endif // defined(DEBUG)
int result = pthread_mutex_unlock(data_.mutex());
// Specifically check for wrong thread unlocking to aid debugging.
ASSERT(result != EPERM);

Powered by Google App Engine
This is Rietveld 408576698