summaryrefslogtreecommitdiff
path: root/db/clientcursor.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-07-24 21:58:39 -0400
committerEliot Horowitz <eliot@10gen.com>2010-07-24 21:58:39 -0400
commiteb194af185f29ca95fc0e4f38df217e27c6f7ca0 (patch)
tree1b4f56ff274ef8e8c142762d0130aee9a09e4c35 /db/clientcursor.h
parent778a6ebce63f857d5a2b078f2c2ed86914dad983 (diff)
downloadmongo-eb194af185f29ca95fc0e4f38df217e27c6f7ca0.tar.gz
Cursor::supportYields SERVER-1453
Diffstat (limited to 'db/clientcursor.h')
-rw-r--r--db/clientcursor.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/db/clientcursor.h b/db/clientcursor.h
index 46f3a2eb70b..188c10ea51a 100644
--- a/db/clientcursor.h
+++ b/db/clientcursor.h
@@ -200,9 +200,11 @@ namespace mongo {
struct YieldLock : boost::noncopyable {
explicit YieldLock( ptr<ClientCursor> cc )
- : _cc( cc ) , _id( cc->cursorid ) , _doingDeletes( cc->_doingDeletes ) {
- cc->updateLocation();
- _unlock.reset(new dbtempreleasecond());
+ : _cc( cc ) , _id( cc->cursorid ) , _doingDeletes( cc->_doingDeletes ), _canYield(cc->c->supportYields()) {
+ if ( _canYield ){
+ cc->updateLocation();
+ _unlock.reset(new dbtempreleasecond());
+ }
}
~YieldLock(){
if ( _unlock ){
@@ -212,6 +214,9 @@ namespace mongo {
}
bool stillOk(){
+ if ( ! _canYield )
+ return true;
+
relock();
if ( ClientCursor::find( _id , false ) == 0 ){
@@ -224,13 +229,15 @@ namespace mongo {
}
void relock(){
- _unlock.reset();
+ if ( _canYield )
+ _unlock.reset();
}
private:
ClientCursor * _cc;
CursorId _id;
bool _doingDeletes;
+ bool _canYield;
scoped_ptr<dbtempreleasecond> _unlock;