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

Unified Diff: runtime/vm/lockers.h

Issue 1717803002: Add a SafepointMutexLocker class so that it is possible to have scopes inside the MutexLocker which… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-code-review 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
Index: runtime/vm/lockers.h
diff --git a/runtime/vm/lockers.h b/runtime/vm/lockers.h
index 42b09841d19cc1d065228fadf4d2480e1ac929ab..fd324f44811551673dd7a25f823abac28bac1b2e 100644
--- a/runtime/vm/lockers.h
+++ b/runtime/vm/lockers.h
@@ -71,6 +71,25 @@ class MonitorLocker : public ValueObject {
DISALLOW_COPY_AND_ASSIGN(MonitorLocker);
};
+
+// SafepointMutexLocker objects are used in code where the locks are
+// more coarse grained and a safepoint operation could be potentially
+// triggered while holding this lock. This ensures that other threads
+// which try to acquire the same lock will be marked as being at a
+// safepoint when they are blocked.
+class SafepointMutexLocker : public ValueObject {
+ public:
+ explicit SafepointMutexLocker(Mutex* mutex);
+ virtual ~SafepointMutexLocker() {
+ mutex_->Unlock();
+ }
+
+ private:
+ Mutex* const mutex_;
+
+ DISALLOW_COPY_AND_ASSIGN(SafepointMutexLocker);
+};
+
} // namespace dart
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.cc ('k') | runtime/vm/lockers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698