diff options
author | Aaron <aaron@10gen.com> | 2012-04-29 19:55:45 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-05-05 11:04:06 -0700 |
commit | bfaff395710f25937141fcbfc9f1c062a1ae251d (patch) | |
tree | 7907e38e0545f76af1f526e25ca60d55cc3015a7 /src/mongo/db/clientcursor.h | |
parent | 11491b034fd9d65356e548ba85659fef8e83d2f3 (diff) | |
download | mongo-bfaff395710f25937141fcbfc9f1c062a1ae251d.tar.gz |
Reorganize ClientCursor::Pin a bit.
Diffstat (limited to 'src/mongo/db/clientcursor.h')
-rw-r--r-- | src/mongo/db/clientcursor.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index f6ee59bc637..d638fcb5272 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -87,18 +87,7 @@ namespace mongo { had a bug, it could (or perhaps some sort of attack situation). */ class Pin : boost::noncopyable { - CursorId _cursorid; public: - ClientCursor *c() const { return ClientCursor::find( _cursorid ); } - void release() { - ClientCursor *cursor = c(); - _cursorid = INVALID_CURSOR_ID; - if ( cursor ) { - verify( cursor->_pinValue >= 100 ); - cursor->_pinValue -= 100; - } - } - ~Pin() { DESTRUCTOR_GUARD( release(); ) } Pin( long long cursorid ) : _cursorid( INVALID_CURSOR_ID ) { recursive_scoped_lock lock( ccmutex ); @@ -110,6 +99,18 @@ namespace mongo { _cursorid = cursorid; } } + void release() { + ClientCursor *cursor = c(); + _cursorid = INVALID_CURSOR_ID; + if ( cursor ) { + verify( cursor->_pinValue >= 100 ); + cursor->_pinValue -= 100; + } + } + ~Pin() { DESTRUCTOR_GUARD( release(); ) } + ClientCursor *c() const { return ClientCursor::find( _cursorid ); } + private: + CursorId _cursorid; }; /** Assures safe and reliable cleanup of a ClientCursor. */ |