summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-11-13 13:02:48 -0500
committerdwight <dwight@10gen.com>2010-11-13 13:02:48 -0500
commit5ec52a8161f4616095edbfaabed679e1b9697058 (patch)
treeb9aa7e9e457821cbfcd98ff697c670c70a807359 /client
parent4598eae43f65f749d12f676d13cf2d9d13516603 (diff)
downloadmongo-5ec52a8161f4616095edbfaabed679e1b9697058.tar.gz
comments
Diffstat (limited to 'client')
-rw-r--r--client/distlock.cpp2
-rw-r--r--client/distlock.h26
2 files changed, 9 insertions, 19 deletions
diff --git a/client/distlock.cpp b/client/distlock.cpp
index fee82164bd7..7e18ab27a58 100644
--- a/client/distlock.cpp
+++ b/client/distlock.cpp
@@ -16,9 +16,7 @@
*/
#include "pch.h"
-
#include "boost/thread/once.hpp"
-
#include "dbclient.h"
#include "distlock.h"
diff --git a/client/distlock.h b/client/distlock.h
index f29f11ed3c8..256741e8607 100644
--- a/client/distlock.h
+++ b/client/distlock.h
@@ -15,11 +15,6 @@
* limitations under the License.
*/
-
-/**
- * distributed locking mechanism
- */
-
#pragma once
#include "../pch.h"
@@ -30,10 +25,14 @@
namespace mongo {
+ /**
+ * distributed locking mechanism
+ */
class DistributedLock {
public:
/**
+ what does this do ??? what is conn? name?
* @param takeoverMinutes how long before we steal lock in minutes
*/
DistributedLock( const ConnectionString& conn , const string& name , unsigned takeoverMinutes = 10 );
@@ -52,31 +51,24 @@ namespace mongo {
class dist_lock_try {
public:
-
dist_lock_try( DistributedLock * lock , string why )
: _lock(lock){
_got = _lock->lock_try( why , &_other );
}
- ~dist_lock_try(){
- if ( _got ){
+ ~dist_lock_try() {
+ if ( _got ) {
_lock->unlock();
}
}
- bool got() const {
- return _got;
- }
-
- BSONObj other() const {
- return _other;
- }
+ bool got() const { return _got; }
+ BSONObj other() const { return _other; }
private:
DistributedLock * _lock;
bool _got;
- BSONObj _other;
-
+ BSONObj _other;
};
}