summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog/dist_lock_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/catalog/dist_lock_manager.cpp')
-rw-r--r--src/mongo/s/catalog/dist_lock_manager.cpp56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/mongo/s/catalog/dist_lock_manager.cpp b/src/mongo/s/catalog/dist_lock_manager.cpp
index e40504e2ff9..834e235b1e9 100644
--- a/src/mongo/s/catalog/dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/dist_lock_manager.cpp
@@ -36,45 +36,41 @@
namespace mongo {
- const stdx::chrono::milliseconds DistLockManager::kDefaultSingleLockAttemptTimeout(0);
- const stdx::chrono::milliseconds DistLockManager::kDefaultLockRetryInterval(1000);
+const stdx::chrono::milliseconds DistLockManager::kDefaultSingleLockAttemptTimeout(0);
+const stdx::chrono::milliseconds DistLockManager::kDefaultLockRetryInterval(1000);
- DistLockManager::ScopedDistLock::ScopedDistLock(): _lockManager(nullptr) {
- }
-
- DistLockManager::ScopedDistLock::ScopedDistLock(DistLockHandle lockHandle,
- DistLockManager* lockManager):
- _lockID(std::move(lockHandle)), _lockManager(lockManager) {
- }
+DistLockManager::ScopedDistLock::ScopedDistLock() : _lockManager(nullptr) {}
- DistLockManager::ScopedDistLock::~ScopedDistLock() {
- if (_lockManager) {
- _lockManager->unlock(_lockID);
- }
- }
+DistLockManager::ScopedDistLock::ScopedDistLock(DistLockHandle lockHandle,
+ DistLockManager* lockManager)
+ : _lockID(std::move(lockHandle)), _lockManager(lockManager) {}
- DistLockManager::ScopedDistLock::ScopedDistLock(ScopedDistLock&& other) {
- *this = std::move(other);
+DistLockManager::ScopedDistLock::~ScopedDistLock() {
+ if (_lockManager) {
+ _lockManager->unlock(_lockID);
}
+}
- DistLockManager::ScopedDistLock&
- DistLockManager::ScopedDistLock::operator=(ScopedDistLock&& other) {
- if (this != &other) {
- _lockID = std::move(other._lockID);
- _lockManager = other._lockManager;
- other._lockManager = nullptr;
- }
+DistLockManager::ScopedDistLock::ScopedDistLock(ScopedDistLock&& other) {
+ *this = std::move(other);
+}
- return *this;
+DistLockManager::ScopedDistLock& DistLockManager::ScopedDistLock::operator=(
+ ScopedDistLock&& other) {
+ if (this != &other) {
+ _lockID = std::move(other._lockID);
+ _lockManager = other._lockManager;
+ other._lockManager = nullptr;
}
- Status DistLockManager::ScopedDistLock::checkStatus() {
- if (!_lockManager) {
- return Status(ErrorCodes::IllegalOperation,
- "no lock manager, lock was not acquired");
- }
+ return *this;
+}
- return _lockManager->checkStatus(_lockID);
+Status DistLockManager::ScopedDistLock::checkStatus() {
+ if (!_lockManager) {
+ return Status(ErrorCodes::IllegalOperation, "no lock manager, lock was not acquired");
}
+ return _lockManager->checkStatus(_lockID);
+}
}