diff options
-rw-r--r-- | client/distlock.cpp | 2 | ||||
-rw-r--r-- | client/distlock.h | 26 |
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; }; } |