summaryrefslogtreecommitdiff
path: root/db/concurrency.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-11-09 15:21:16 -0500
committerEliot Horowitz <eliot@10gen.com>2009-11-09 15:21:16 -0500
commitcbc63f0741a2e4c34e8ea8d90efd6b2762fed776 (patch)
tree4c735bb9c7de2d72f2b830740fc08646072928e5 /db/concurrency.h
parent76d849e09077d1b3dbd5cad3fe296ca06e91119f (diff)
downloadmongo-cbc63f0741a2e4c34e8ea8d90efd6b2762fed776.tar.gz
add (read|write)lock struct that currently do the same thing as dblock
Diffstat (limited to 'db/concurrency.h')
-rw-r--r--db/concurrency.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/db/concurrency.h b/db/concurrency.h
index 83e02a09b5b..1b4822be2e0 100644
--- a/db/concurrency.h
+++ b/db/concurrency.h
@@ -65,12 +65,38 @@ namespace mongo {
struct dblock : public lock {
dblock() :
- lock( dbMutex, dbMutexInfo ) {
+ lock( dbMutex, dbMutexInfo ) {
}
~dblock() {
dbunlocking();
}
};
+
+ struct writelock : public lock {
+ writelock(const string& ns) :
+ lock( dbMutex, dbMutexInfo ) {
+ }
+ writelock(const char * ns) :
+ lock( dbMutex, dbMutexInfo ) {
+ }
+ ~writelock() {
+ dbunlocking();
+ }
+ };
+
+ struct readlock : public lock {
+ readlock(const string& ns) :
+ lock( dbMutex, dbMutexInfo ) {
+ }
+ readlock(const char* ns) :
+ lock( dbMutex, dbMutexInfo ) {
+ }
+ ~readlock() {
+ dbunlocking();
+ }
+ };
+
+
/* a scoped release of a mutex temporarily -- like a scopedlock but reversed.
*/