diff options
author | Dwight <dwight@10gen.com> | 2012-02-17 15:22:26 -0500 |
---|---|---|
committer | Dwight <dwight@10gen.com> | 2012-02-17 15:22:26 -0500 |
commit | 9528f3d6a08ce69052dd9b52d51887e4a1d55ce0 (patch) | |
tree | 7428ad15085b856cf981e5c7c33c9e955c22b905 /src/mongo/db/db.h | |
parent | e8b24ae77d0d9558a50a60e38fdea0f067d4fae8 (diff) | |
download | mongo-9528f3d6a08ce69052dd9b52d51887e4a1d55ce0.tar.gz |
SERVER-4328 it is ok to not tempreleasecond when nested fix the new impl to not assert
Diffstat (limited to 'src/mongo/db/db.h')
-rw-r--r-- | src/mongo/db/db.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mongo/db/db.h b/src/mongo/db/db.h index dd7818b6428..7fa1b521634 100644 --- a/src/mongo/db/db.h +++ b/src/mongo/db/db.h @@ -36,7 +36,10 @@ namespace mongo { const Client& c = cc(); _context = c.getContext(); assert( Lock::isLocked() ); - massert(10298 , "can't temprelease nested lock", !Lock::nested()); + if( Lock::nested() ) { + Lock::nested(); + massert(10298 , "can't temprelease nested lock", false); + } if ( _context ) { _context->unlocked(); } @@ -81,12 +84,17 @@ namespace mongo { /** only does a temp release if we're not nested and have a lock */ - struct dbtempreleasecond { + class dbtempreleasecond : boost::noncopyable { dbtemprelease * real; + public: dbtempreleasecond() { real = 0; - if( Lock::isLocked() ) - real = new dbtemprelease(); + if( Lock::isLocked() ) { + // if nested don't temprelease, and we don't complain either for this class + if( !Lock::nested() ) { + real = new dbtemprelease(); + } + } } ~dbtempreleasecond() { if ( real ) { @@ -94,9 +102,7 @@ namespace mongo { real = 0; } } - bool unlocked() { - return real != 0; - } + bool unlocked() const { return real != 0; } }; } // namespace mongo |