MCPcopy Create free account
hub / github.com/cztomczak/cefpython / AutoLock

Class AutoLock

src/include/base/cef_lock.h:124–142  ·  view source on GitHub ↗

A helper class that acquires the given Lock while the AutoLock is in scope.

Source from the content-addressed store, hash-verified

122
123// A helper class that acquires the given Lock while the AutoLock is in scope.
124class AutoLock {
125 public:
126 struct AlreadyAcquired {};
127
128 explicit AutoLock(Lock& lock) : lock_(lock) { lock_.Acquire(); }
129
130 AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) {
131 lock_.AssertAcquired();
132 }
133
134 ~AutoLock() {
135 lock_.AssertAcquired();
136 lock_.Release();
137 }
138
139 private:
140 Lock& lock_;
141 DISALLOW_COPY_AND_ASSIGN(AutoLock);
142};
143
144// AutoUnlock is a helper that will Release() the |lock| argument in the
145// constructor, and re-Acquire() it in the destructor.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected