Index: base/synchronization/lock.h |
diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h |
index bec37fbb3567d61ec321d23c20bf1071ddd89ba9..7e8ffe7b741bcdde1d39f69a9a123f906824a661 100644 |
--- a/base/synchronization/lock.h |
+++ b/base/synchronization/lock.h |
@@ -96,10 +96,16 @@ class BASE_EXPORT Lock { |
// A helper class that acquires the given Lock while the AutoLock is in scope. |
class AutoLock { |
public: |
+ struct AlreadyAcquired {}; |
+ |
explicit AutoLock(Lock& lock) : lock_(lock) { |
lock_.Acquire(); |
} |
+ AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) { |
+ lock_.AssertAcquired(); |
+ } |
+ |
~AutoLock() { |
lock_.AssertAcquired(); |
lock_.Release(); |