From 8fe3bcbcfdf65d8e081f32e8767e33cd9624a5a4 Mon Sep 17 00:00:00 2001 From: dwight Date: Wed, 15 Jun 2011 22:07:31 -0400 Subject: [PATCH] cleaning elim unused parm --- dbtests/threadedtests.cpp | 2 +- util/concurrency/rwlock.h | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dbtests/threadedtests.cpp b/dbtests/threadedtests.cpp index 5e2e43ce0bf..1e379750eba 100644 --- a/dbtests/threadedtests.cpp +++ b/dbtests/threadedtests.cpp @@ -240,7 +240,7 @@ namespace ThreadedTests { void run() { RWLock lk( "eliot" ); { - rwlock r( lk , true , false , 1000 ); + rwlock r( lk , true , 1000 ); } } }; diff --git a/util/concurrency/rwlock.h b/util/concurrency/rwlock.h index 15ec406f5e3..10c628d8e86 100644 --- a/util/concurrency/rwlock.h +++ b/util/concurrency/rwlock.h @@ -57,6 +57,7 @@ namespace mongo { #if defined(MONGO_USE_SRW_ON_WINDOWS) && defined(_WIN32) + // Windows RWLock implementation (requires newer versions of windows thus the above macro) class RWLock : boost::noncopyable { public: RWLock(const char *, int lowPriorityWaitMS=0 ) : _lowPriorityWaitMS(lowPriorityWaitMS) @@ -102,9 +103,11 @@ namespace mongo { }; #elif defined(BOOST_RWLOCK) + + // Boost RWLock implementation class RWLock : boost::noncopyable { shared_mutex _m; - int _lowPriorityWaitMS; + const int _lowPriorityWaitMS; public: #if defined(_DEBUG) const char *_name; @@ -157,10 +160,13 @@ namespace mongo { }; + #else + + // Posix RWLock implementation class RWLock : boost::noncopyable { pthread_rwlock_t _lock; - int _lowPriorityWaitMS; + const int _lowPriorityWaitMS; inline static void check( int x ) { if( x == 0 ) return; @@ -279,14 +285,10 @@ namespace mongo { * @param write acquire write lock if true sharable if false * @param lowPriority if > 0, will try to get the lock non-greedily for that many ms */ - rwlock( const RWLock& lock , bool write , bool alreadyHaveLock = false , int lowPriorityWaitMS = 0 ) + rwlock( const RWLock& lock , bool write, /* bool alreadyHaveLock = false , */int lowPriorityWaitMS = 0 ) : _lock( (RWLock&)lock ) , _write( write ) { - // alreadyHaveLock should probably go away. this as a starter in that direction: - dassert(!alreadyHaveLock); - - if ( ! alreadyHaveLock ) { - + { if ( _write ) { if ( ! lowPriorityWaitMS && lock.lowPriorityWaitMS() ) @@ -338,7 +340,8 @@ namespace mongo { RWLock _lk; friend class Exclusive; public: - RWLockRecursive(const char *name, int lpwait) : _lk(name, lpwait) { } + /** @param lpwaitms lazy wait */ + RWLockRecursive(const char *name, int lpwaitms) : _lk(name, lpwaitms) { } void assertExclusivelyLocked() { dassert( _state.get() < 0 );