diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-04-25 09:49:01 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-04-25 09:49:01 -0400 |
commit | d6997cbf795353e2edb2f62500a1853bfd9dc0eb (patch) | |
tree | 17bfa9d214941952b5d6113993e61a74e344e41b /util | |
parent | 9a3d756d9f436552f80f2159b3bb4c0dc4bb10b7 (diff) | |
download | mongo-d6997cbf795353e2edb2f62500a1853bfd9dc0eb.tar.gz |
some tests for locking trying to debug bizarre RWLock issue
Diffstat (limited to 'util')
-rw-r--r-- | util/concurrency/rwlock.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/util/concurrency/rwlock.h b/util/concurrency/rwlock.h index 28829b8e004..ac21fffcfec 100644 --- a/util/concurrency/rwlock.h +++ b/util/concurrency/rwlock.h @@ -62,6 +62,7 @@ namespace mongo { RWLock(const char *, int lowPriorityWaitMS=0 ) : _lowPriorityWaitMS(lowPriorityWaitMS) { InitializeSRWLock(&_lock); } ~RWLock() { } + const char * implType() const { return "WINSRW"; } int lowPriorityWaitMS() const { return _lowPriorityWaitMS; } void lock() { AcquireSRWLockExclusive(&_lock); } void unlock() { ReleaseSRWLockExclusive(&_lock); } @@ -112,6 +113,8 @@ namespace mongo { RWLock(const char *, int lowPriorityWait=0) : _lowPriorityWaitMS(lowPriorityWait) { } #endif + const char * implType() const { return "boost"; } + int lowPriorityWaitMS() const { return _lowPriorityWaitMS; } void lock() { @@ -185,6 +188,8 @@ namespace mongo { } } + const char * implType() const { return "posix"; } + int lowPriorityWaitMS() const { return _lowPriorityWaitMS; } void lock() { @@ -292,7 +297,7 @@ namespace mongo { if ( lowPriorityWaitMS ) { bool got = false; - for ( int i=0; i<lowPriorityWaitMS; i++ ) { // we divide by 2 since we sleep a bit + for ( int i=0; i<lowPriorityWaitMS; i++ ) { if ( _lock.lock_try(0) ) { got = true; break; |