summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-11-27 22:28:22 -0500
committerEliot Horowitz <eliot@10gen.com>2009-11-27 22:28:22 -0500
commit2420ed1d05a0d8d9d3ba1b479305cb10c95b9497 (patch)
tree404ba5a3e02778bfe93c8c0de9292096df02e109
parentc44bff08fd95616302a73e92b48b2853c1fd948d (diff)
parent5d1e53387f5be6cc664d18699be76f1227fa6b6d (diff)
downloadmongo-2420ed1d05a0d8d9d3ba1b479305cb10c95b9497.tar.gz
Merge branch 'master' of github.com:mongodb/mongo
-rw-r--r--db/clientcursor.h5
-rw-r--r--db/concurrency.h14
-rw-r--r--db/nonce.cpp8
-rw-r--r--db/reccache.h8
4 files changed, 19 insertions, 16 deletions
diff --git a/db/clientcursor.h b/db/clientcursor.h
index 79907ea2424..e076daa9873 100644
--- a/db/clientcursor.h
+++ b/db/clientcursor.h
@@ -76,9 +76,6 @@ namespace mongo {
DiskLoc lastLoc() const {
return _lastLoc;
}
- private:
- void setLastLoc_inlock(DiskLoc);
- public:
auto_ptr< FieldMatcher > filter; // which fields query wants returned
Message originalMessage; // this is effectively an auto ptr for data the matcher points to
@@ -89,6 +86,8 @@ namespace mongo {
static void invalidate(const char *nsPrefix);
private:
+ void setLastLoc_inlock(DiskLoc);
+
static ClientCursor* find_inlock(CursorId id, bool warn = true) {
CCById::iterator it = clientCursorsById.find(id);
if ( it == clientCursorsById.end() ) {
diff --git a/db/concurrency.h b/db/concurrency.h
index 1b4822be2e0..7120b2f8301 100644
--- a/db/concurrency.h
+++ b/db/concurrency.h
@@ -61,14 +61,16 @@ namespace mongo {
}
};
- void dbunlocking();
+ void dbunlocking_write();
+ void dbunlocking_read();
+ /* use writelock and readlock instead */
struct dblock : public lock {
dblock() :
lock( dbMutex, dbMutexInfo ) {
}
~dblock() {
- dbunlocking();
+ dbunlocking_write();
}
};
@@ -80,7 +82,7 @@ namespace mongo {
lock( dbMutex, dbMutexInfo ) {
}
~writelock() {
- dbunlocking();
+ dbunlocking_write();
}
};
@@ -92,13 +94,11 @@ namespace mongo {
lock( dbMutex, dbMutexInfo ) {
}
~readlock() {
- dbunlocking();
+ dbunlocking_read();
}
};
-
-
- /* a scoped release of a mutex temporarily -- like a scopedlock but reversed.
+ /* a scoped release of a mutex temporarily -- like a scopedlock but reversed.
*/
struct temprelease {
boost::mutex& m;
diff --git a/db/nonce.cpp b/db/nonce.cpp
index 60899530499..bf4bb6f44d9 100644
--- a/db/nonce.cpp
+++ b/db/nonce.cpp
@@ -33,8 +33,8 @@ namespace mongo {
_initialized = true;
#if defined(__linux__)
- devrandom = new ifstream("/dev/urandom", ios::binary|ios::in);
- massert( "can't open dev/urandom", devrandom->is_open() );
+ _devrandom = new ifstream("/dev/urandom", ios::binary|ios::in);
+ massert( "can't open dev/urandom", _devrandom->is_open() );
#elif defined(_WIN32)
srand(curTimeMicros());
#else
@@ -56,8 +56,8 @@ namespace mongo {
nonce n;
#if defined(__linux__)
- devrandom->read((char*)&n, sizeof(n));
- massert("devrandom failed", !devrandom->fail());
+ _devrandom->read((char*)&n, sizeof(n));
+ massert("devrandom failed", !_devrandom->fail());
#elif defined(_WIN32)
n = (((unsigned long long)rand())<<32) | rand();
#else
diff --git a/db/reccache.h b/db/reccache.h
index 4cb4e31bb21..b01453daa30 100644
--- a/db/reccache.h
+++ b/db/reccache.h
@@ -223,10 +223,14 @@ public:
}
};
-inline void dbunlocking() {
- theRecCache.ejectOld();
+inline void dbunlocking_read() {
Client *c = currentClient.get();
c->top.clientStop();
}
+inline void dbunlocking_write() {
+ theRecCache.ejectOld();
+ dbunlocking_read();
+}
+
} /*namespace*/