summaryrefslogtreecommitdiffstats
path: root/base/lock.h
diff options
context:
space:
mode:
authormmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 16:19:43 +0000
committermmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 16:19:43 +0000
commit08048c71997f7ec047f20fb0132db3884bada97d (patch)
treeea1aa92547415c6597ad15b37590887cb28a2316 /base/lock.h
parent7fc9f719bfd04c02539cab7ca5da4fdc3eda588e (diff)
downloadchromium_src-08048c71997f7ec047f20fb0132db3884bada97d.zip
chromium_src-08048c71997f7ec047f20fb0132db3884bada97d.tar.gz
chromium_src-08048c71997f7ec047f20fb0132db3884bada97d.tar.bz2
Port LockImpl, Lock, and ConditionVariable to pthreads-supporting platforms.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lock.h')
-rw-r--r--base/lock.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/base/lock.h b/base/lock.h
index 59b0aea..249dae3 100644
--- a/base/lock.h
+++ b/base/lock.h
@@ -27,8 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef BASE_LOCK_H__
-#define BASE_LOCK_H__
+#ifndef BASE_LOCK_H_
+#define BASE_LOCK_H_
#include "base/lock_impl.h"
@@ -50,6 +50,11 @@ class Lock {
// held by something else, immediately return false.
bool Try();
+ // Return the underlying lock implementation.
+ // TODO(awalker): refactor lock and condition variables so that this is
+ // unnecessary.
+ LockImpl* lock_impl() { return &lock_; }
+
private:
LockImpl lock_; // User-supplied underlying lock implementation.
@@ -69,7 +74,7 @@ class Lock {
int32 contention_count_;
#endif // NDEBUG
- DISALLOW_EVIL_CONSTRUCTORS(Lock);
+ DISALLOW_COPY_AND_ASSIGN(Lock);
};
// A helper class that acquires the given Lock while the AutoLock is in scope.
@@ -85,7 +90,7 @@ class AutoLock {
private:
Lock& lock_;
- DISALLOW_EVIL_CONSTRUCTORS(AutoLock);
+ DISALLOW_COPY_AND_ASSIGN(AutoLock);
};
// AutoUnlock is a helper class for ConditionVariable instances
@@ -111,4 +116,4 @@ class AutoUnlock {
int release_count_;
};
-#endif // BASE_LOCK_H__
+#endif // BASE_LOCK_H_