summaryrefslogtreecommitdiff
path: root/db/db.h
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
commit5d342a758c6095b4d30aba0750b54f13b8916f51 (patch)
tree762e9aa84781f5e3b96db2c02d356c29cf0217c0 /db/db.h
parentcbe2d992e9cd1ea66af9fa91df006106775d3073 (diff)
downloadmongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz
Imported Upstream version 2.0.0
Diffstat (limited to 'db/db.h')
-rw-r--r--db/db.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/db/db.h b/db/db.h
index 7ef7d03..f3e6b05 100644
--- a/db/db.h
+++ b/db/db.h
@@ -17,9 +17,10 @@
#pragma once
#include "../pch.h"
-#include "../util/message.h"
+#include "../util/net/message.h"
#include "concurrency.h"
#include "pdfile.h"
+#include "curop.h"
#include "client.h"
namespace mongo {
@@ -142,7 +143,8 @@ namespace mongo {
int _locktype;
dbtemprelease() {
- _context = cc().getContext();
+ const Client& c = cc();
+ _context = c.getContext();
_locktype = dbMutex.getState();
assert( _locktype );
@@ -156,7 +158,10 @@ namespace mongo {
if ( _context ) _context->unlocked();
dbMutex.unlock_shared();
}
-
+
+ verify( 14814 , c.curop() );
+ c.curop()->yielded();
+
}
~dbtemprelease() {
if ( _locktype > 0 )
@@ -168,6 +173,33 @@ namespace mongo {
}
};
+ /** must be write locked
+ no assert (and no release) if nested write lock
+ a lot like dbtempreleasecond but no malloc so should be a tiny bit faster
+ */
+ struct dbtempreleasewritelock {
+ Client::Context * _context;
+ int _locktype;
+ dbtempreleasewritelock() {
+ const Client& c = cc();
+ _context = c.getContext();
+ _locktype = dbMutex.getState();
+ assert( _locktype >= 1 );
+ if( _locktype > 1 )
+ return; // nested
+ if ( _context )
+ _context->unlocked();
+ dbMutex.unlock();
+ verify( 14845 , c.curop() );
+ c.curop()->yielded();
+ }
+ ~dbtempreleasewritelock() {
+ if ( _locktype == 1 )
+ dbMutex.lock();
+ if ( _context )
+ _context->relocked();
+ }
+ };
/**
only does a temp release if we're not nested and have a lock