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

Unified Diff: rlz/lib/recursive_lock.h

Issue 11361057: [cros] Add RecursiveLock for CrOS implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 1 month 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
« no previous file with comments | « no previous file | rlz/lib/recursive_lock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rlz/lib/recursive_lock.h
diff --git a/rlz/lib/recursive_lock.h b/rlz/lib/recursive_lock.h
new file mode 100644
index 0000000000000000000000000000000000000000..43c957472d5c3d05b7826bb95ba40d1c5b980864
--- /dev/null
+++ b/rlz/lib/recursive_lock.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_
+#define RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_
+
+#include "base/atomicops.h"
+#include "base/basictypes.h"
+#include "base/synchronization/lock.h"
+
+namespace rlz_lib {
+
+
+class RecursiveLock {
+ public:
+ RecursiveLock();
+ ~RecursiveLock();
+
+ void Acquire();
+ void Release();
+
+ private:
+ // Underlying non-recursive lock.
+ base::Lock lock_;
+ // Owner thread ID.
+ base::subtle::Atomic32 owner_;
+ // Recursion lock depth.
+ int recursion_;
+};
+
+} // namespace rlz_lib
+
+#endif // RLZ_CHROMEOS_LIB_RECURSIVE_LOCK_H_
« no previous file with comments | « no previous file | rlz/lib/recursive_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698