summaryrefslogtreecommitdiff
path: root/util/mutexlock.h
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>2011-04-19 23:01:25 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529>2011-04-19 23:01:25 +0000
commitb743906eeabc925f3e824d91a9747012bf249e2f (patch)
treee7cb4f854196c43045756469627920e4e7b146c1 /util/mutexlock.h
parentb409afe968b6917574ec08e02c4bf6e6f722e3ca (diff)
downloadleveldb-b743906eeabc925f3e824d91a9747012bf249e2f.tar.gz
Revision created by MOE tool push_codebase.
MOE_MIGRATION= git-svn-id: https://leveldb.googlecode.com/svn/trunk@22 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'util/mutexlock.h')
-rw-r--r--util/mutexlock.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/util/mutexlock.h b/util/mutexlock.h
deleted file mode 100644
index 05fe279..0000000
--- a/util/mutexlock.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file. See the AUTHORS file for names of contributors.
-
-#ifndef STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_
-#define STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_
-
-#include "port/port.h"
-
-namespace leveldb {
-
-// Helper class that locks a mutex on construction and unlocks the mutex when
-// the destructor of the MutexLock object is invoked.
-//
-// Typical usage:
-//
-// void MyClass::MyMethod() {
-// MutexLock l(&mu_); // mu_ is an instance variable
-// ... some complex code, possibly with multiple return paths ...
-// }
-
-class MutexLock {
- public:
- explicit MutexLock(port::Mutex *mu) : mu_(mu) {
- this->mu_->Lock();
- }
- ~MutexLock() { this->mu_->Unlock(); }
-
- private:
- port::Mutex *const mu_;
- // No copying allowed
- MutexLock(const MutexLock&);
- void operator=(const MutexLock&);
-};
-
-}
-
-
-#endif // STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_