diff options
author | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 10:38:59 +0000 |
---|---|---|
committer | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 10:38:59 +0000 |
commit | afb14c2cc6095d515aa0754fb6e1e1c44db091b6 (patch) | |
tree | f22113e474f2b7329e3f49b8ff887104f0a29775 /rlz/lib/recursive_lock.h | |
parent | bfdd5c40a2e31b52cda6b1bb782eadb286f6f2d5 (diff) | |
download | chromium_src-afb14c2cc6095d515aa0754fb6e1e1c44db091b6.zip chromium_src-afb14c2cc6095d515aa0754fb6e1e1c44db091b6.tar.gz chromium_src-afb14c2cc6095d515aa0754fb6e1e1c44db091b6.tar.bz2 |
[cros] Add RecursiveLock for CrOS implementation.
BUG=157348
Review URL: https://chromiumcodereview.appspot.com/11361057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'rlz/lib/recursive_lock.h')
-rw-r--r-- | rlz/lib/recursive_lock.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rlz/lib/recursive_lock.h b/rlz/lib/recursive_lock.h new file mode 100644 index 0000000..43c95747 --- /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_ |