diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-11-09 15:21:16 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-11-09 15:21:16 -0500 |
commit | cbc63f0741a2e4c34e8ea8d90efd6b2762fed776 (patch) | |
tree | 4c735bb9c7de2d72f2b830740fc08646072928e5 /db/concurrency.h | |
parent | 76d849e09077d1b3dbd5cad3fe296ca06e91119f (diff) | |
download | mongo-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.h | 28 |
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. */ |