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 |