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

Unified Diff: base/synchronization/lock.h

Issue 14387002: Adding TryPostTask to the message loop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bool Created 7 years, 8 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
« base/message_loop_unittest.cc ('K') | « base/message_loop_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/lock.h
diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h
index bec37fbb3567d61ec321d23c20bf1071ddd89ba9..05669c6ab755f93df64ebe77d1a8d3b97c1f3538 100644
--- a/base/synchronization/lock.h
+++ b/base/synchronization/lock.h
@@ -96,10 +96,15 @@ class BASE_EXPORT Lock {
// A helper class that acquires the given Lock while the AutoLock is in scope.
class AutoLock {
public:
+ struct NoAcquire {};
jar (doing other things) 2013/04/26 21:59:43 I have a habit (religion?) of avoiding a negative
+
explicit AutoLock(Lock& lock) : lock_(lock) {
lock_.Acquire();
}
+ AutoLock(Lock& lock, const NoAcquire&) : lock_(lock) {
+ }
jar (doing other things) 2013/04/21 15:29:35 If you stick with this API... I'd suggest: lock_.
+
~AutoLock() {
lock_.AssertAcquired();
lock_.Release();
« base/message_loop_unittest.cc ('K') | « base/message_loop_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698